Novartis will pay $300 million upfront to Glaxo and another $200 million once late-stage clinical trials start. Novartis would make payments of up to $534 million on top of that, depending on whether development targets are reached. The company will also pay royalties of up to 12 percent to Glaxo on any future net sales of the drug.

“Novartis is pleased to further reinforce our commitment to neuroscience and to add an exciting new treatment to our strong MS portfolio,” David Epstein, the division head of Novartis Pharmaceuticals, said in a news release.

In addition to Gilenya, Novartis sells a multiple sclerosis drug called Extavia and recently began marketing a generic version of Teva’s Copaxone, one of the most widely used drugs for the disease. It also has some other drugs in development. Gilenya could lose patent protection starting in 2019. So filling the loss could be another reason for Novartis to want a new drug.

But the market for multiple sclerosis drugs is crowded, which could limit the sales any new drug like ofatumumab could have. Moreover, ofatumumab is only now ready to enter late-stage clinical trials, putting it a couple of years behind ocrelizumab, a similar drug being developed by Roche.

Both drugs deplete B cells, which are white blood cells that are part of the immune system. B cells are necessary to fight infections, but if they go awry, they can contribute to autoimmune diseases like multiple sclerosis or to lymphomas. Both drugs bind to the same molecule on the surface of B cells — known as CD20 — as Roche’s big-selling cancer drug Rituxan. Rituxan is not approved for multiple sclerosis, but it is approved to treat rheumatoid arthritis, another autoimmune disease.