Neurocrine Biosciences has plunked down $50 million upfront for a potential epilepsy treatment, the San Diego company’s second major licensing deal this year.

In a transaction announced Dec. 2, Neurocrine paid Xenon Pharmaceuticals $30 million and invested $20 million in the company. Neurocrine gained rights to XEN901, which is in mid-stage clinical trials for a rare form of pediatric epilepsy called SCN8A-EE.

SCN8A-EE slows childhood development — and can even cause regression.

In addition, XEN901 has the potential to treat focal sezuires estimated to affect 1 million people, half of whom don’t respond to existing treatments, the companies said. The deal also includes preclinical compounds and a research collaboration to discover drugs.

All told, Brisitsh Columbia-based Xenon is eligible for up to $1.7 billion in milestone payments that hinge on positive clinical trial results and regulatory approvals.

Xenon has the option to pay half of clinical development costs, in which case it would receive royalties of up to 20% on drug sales.

Neurocrine found commercial success with ingrezza, its drug approved in 2017 for an involutary movement disorder. Last month, ingrezza netted $222.09 in quarterly sales, a 46.3% year-over-year jump, according to the company.

Earlier this year, Neurocrine expanded its pipeline by obtaining four potential gene therapies for $165 million upfront in a deal with Voyager Therapeutics.

"The agreement with Xenon strengthens Neurocrine Biosciences' diverse and growing pipeline and reinforces our long-term commitment of becoming a leading neuroscience-focused biopharmaceutical company,” CEO Kevin Gorman said in a statement.