The state said $90 million in revenue was at stake in its suit over a federal opinion that would have outlawed online lottery sales.

CONCORD — The New Hampshire Lottery Commission won a court victory Monday when a judge ruled a federal law applies only to bets or wagers on sporting events or contests — and not online lottery games.

The lottery commission filed a lawsuit in federal court that maintained a federal memo written last November threatened to render illegal all lottery business conducted online, including games such as Powerball and Mega Millions.

The 60-page ruling by U.S. District Court Judge Paul Barbadoro protects millions of dollars in yearly lottery revenue earmarked for education funding, state officials say.

“Today’s ruling is a historic victory for the state of New Hampshire and we are proud to have led this effort,” said Gov. Chris Sununu. “New Hampshire stood up, took action, and won — all to protect public education in our state.”

Charlie McIntyre, the lottery commission’s executive director, said that the judge “appreciated the strength of our argument and the potential impacts this DOJ (Department of Justice) opinion stood to have in New Hampshire with more than $90 million in revenue for education at stake.”

The judge dismissed the U.S. Department of Justice’s argument that the lottery commission lacked standing to be allowed to sue.

“Based on the text, context, and structure of the Wire Act, I also conclude that the Act is limited to sports gambling,” the judge wrote in his analysis of the Wire Act of 1961.

The closely watched case had attracted “friend of the court” briefs from New Jersey, Pennsylvania and Michigan supporting New Hampshire’s legal efforts.

The New Hampshire Lottery Commission offers tickets for multi-state games such as Powerball and Mega Millions that permit tickets to be purchased either in stores or through the internet. Each game involves the use of interstate wire transmissions.

“We are extremely pleased with the court’s decision, which represents a victory for the New Hampshire Lottery, state lotteries across the country and the revenue they provide to their communities,” McIntyre said.

The commission convinced a judge to rule that the wire act didn’t extend to state-conducted lottery activities and to set aside the 2018 opinion from the Justice Department’s Office of Legal Counsel.

The judge said “nothing the Department of Justice said or did before the plaintiffs filed their complaints gave states like New Hampshire any reason to believe that state actors would not be prosecuted under the OLC’s new interpretation of the Wire Act.”

The judge wrote, “In summary, this is no hypothetical case: The plaintiffs have demonstrated with specific record evidence that they had standing when they filed suit because a sufficiently imminent threat of enforcement loomed.”

A spokesperson for the Justice Department said “DOJ is reviewing the decision and declines to comment further at this time.”