ALBANY, N.Y. (CBSNewYork/AP) — A bill legalizing, regulating and taxing online daily fantasy sports in New York state is on its way to Gov. Andrew Cuomo.

The Senate passed the legislation early Saturday morning as lawmakers worked to end their 2016 session. The Assembly has already endorsed the measure.

It was introduced after New York Attorney General Eric Schneiderman said last year that the games amounted to illegal gambling.

The largest commercial fantasy sports operators, FanDuel and DraftKings, agreed in March to stop taking bets in New York as lawmakers took up the issue.

Under the March stipulation, the companies can’t start operating until the legislation is signed into law by Cuomo.

Schneiderman issued a statement Saturday morning.

“As I have said from the start of my office’s investigation into daily fantasy sports, my job is to enforce the law. Today, the Legislature has amended the law to legalize daily fantasy sports contests, a law that will be my job to enforce and defend,” he said. “We will nevertheless continue to pursue our claims that DraftKings and FanDuel previously engaged in false advertising and consumer fraud.”

FanDuel and DraftKings have long argued their contests are games of skill, not chance.

Cuomo has not said whether he supports the legislation.

(TM and © Copyright 2016 CBS Radio Inc. and its relevant subsidiaries. CBS RADIO and EYE Logo TM and Copyright 2016 CBS Broadcasting Inc. Used under license. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed. The Associated Press contributed to this report.)