(Reuters) - A federal judge on Friday said Allergan Plc's planned generic version of a drug meant to treat epilepsy infringed patents belonging to Supernus Pharmaceuticals Inc.

Shares of Supernus soared as much as 44 percent after the decision was issued. They closed up $2.00, or 19.7 percent, at $12.13 on the Nasdaq.

Supernus sells Oxtellar XR, a once-a-day tablet used to treat partial epilepsy seizures in adults and children over the age of six, and sued the former Actavis Inc to stop it from selling a generic version.

Actavis, now known as Allergan, had filed with U.S. regulators to sell its generic in March 2013, less than two months after Oxtellar XR was launched. It maintained at the time that Supernus' patents were invalid, court papers show.

But in a 136-page decision, U.S. District Judge Renée Marie Bumb in Camden, New Jersey said Allergan's proposed generic infringed two of the three Supernus patents in question. She also said all of the patents were valid.

The judge ruled after a seven-day non-jury trial that ended in early December.

A U.S.-based spokesman for Allergan did not immediately respond to requests for comment. The company is based in Dublin, Ireland.

Oxtellar XR is one of two epilepsy products that Supernus sells, and which together account for most of the Rockville, Maryland-based company's revenue, regulatory filings show.

Epilepsy cannot be cured but can be managed with treatment.

The cases are Supernus Pharmaceuticals Inc v. Actavis Inc et al, U.S. District Court, District of New Jersey, Nos. 13-04740, 14-01981.

(Reporting by Jonathan Stempel in New York; Editing by Bernard Orr)