A state law that legalized daily fantasy sports in New York two years ago was struck down in a decision by Albany County Supreme Court Justice Gerald Connolly on Monday.

Connolly said in the decision that daily fantasy sports, an online game where users create fake teams out of various sports players and either earn or lose money based on their performance, is akin to gambling, and therefore requires an amendment to the state constitution for legalization.

Cornelius Murray, a shareholder at O'Connell and Aronowitz in Albany, represented the plaintiffs in the case against the state. He said he wasn't sure how the state was going to react to the decision, but that daily fantasy sports operators like FanDuel and DraftKings should not be allowed to operate in New York after the ruling.

“The court said the statute that purports to authorize daily fantasy sports in New York is unconstitutional beyond a reasonable doubt,” Murray said. “The only way daily fantasy sports operators can operate in New York is if they have a license and the statute that gives them a license is now unconstitutional.”

Connolly's decision did not criminalize daily fantasy sports in New York. It only nullified the statute that established regulations for companies seeking to operate in the state. Two of the largest daily fantasy sports companies, FanDuel and DraftKings, have been doing business in New York since the law was signed in 2016.

David Boies, chairman of Boies Schiller Flexner and outside counsel for DraftKings, said in a statement that the decision does not stop the company from operating in the state.

“We are pleased that the court upheld the New York legislature's decision to decriminalize daily fantasy sports contests and that DraftKings can continue to offer their services to players,” Boies said. “We are continuing to study the court's decision invalidating the regulatory structure and are committed to working with the legislature.”

FanDuel echoed the same thoughts in a statement from the company.

“The decision makes clear that the New York legislature's decision to exclude fantasy contests from the definition of illegal gambling cannot be challenged in court. Accordingly, we will continue to offer fantasy sports to New Yorkers. We also believe in the benefits of regulation and will cooperate with efforts to permanently restore regulatory oversight,” Fanduel said.

The two companies were largely behind the push to legalize daily fantasy sports in 2016.

Connolly wrote in his decision that daily fantasy sports, while incorporating some skill from its users, also incorporated an element left entirely to chance—their players' performance.

“[Interactive fantasy sports] participants have no control whatsoever of the performance of the selected players, though the experience, research, and related skill involved in selecting an IFS team can sharply impact an IFS participant's chances of prevailing,” Connolly wrote. “As such, the first legislative finding proffered, that is, the rationale for why 'IFS is not a game of chance,' does not lead to the conclusion that there is not, to a material degree, an element of chance to IFS competition.”

Spokesmen for the State Gaming Commission and Gov. Andrew Cuomo, which are both named in the lawsuit, said Monday evening that they were reviewing the decision.

The lawsuit was brought against the state by four plaintiffs who either have a gambling disorder or are relatives of people with a gambling disorder, according to the decision. They argued that daily fantasy sports, while incorporating some skill into gameplay, still leaves much up to blind luck, and should therefore be classified as gambling.

Gambling is illegal in New York unless otherwise legalized by an amendment to the state's constitution. Voters, for example, approved a constitutional amendment in recent years that allowed a handful of new casinos to be established in upstate New York.

The law legalizing daily fantasy sports was not passed through a constitutional amendment. It was enacted solely by the state Legislature and signed into law by Cuomo.

The State Attorney General's Office, according to Connolly's decision, argued that when there's a question of whether an activity is gambling or not, the Legislature is able to declare whether the game should be prohibited or not. In this case, the state did not deny that daily fantasy sports includes some elements of chance, Connolly said, but argued instead that it was a game of skill.

The state used certain submissions to the Legislature to defend its argument, like statistics from FanDuel and DraftKings showing that users were likely to be successful at the game.

Connolly also acknowledge that daily fantasy sports requires some amount of skill, but said that since users have no control over their players' performance or future events that would affect that performance, the game is largely left to chance.

“The fact that IFS is scored based on agglomerated individual performances in future events not under the contestants' control or influence does not negate the fact that the wagers are placed on performances in future events not under the contestants' control or influence,” Connolly wrote.

Assistant Attorney General Richard Lombardo represented the state in the matter. Spokesmen for Cuomo and the Gaming Commission did not say whether they plan to appeal the decision.

READ MORE: