Updated — June 20, 2:30 p.m. ET

New York Gov. Andrew Cuomo during a news conference announcing an agreement on legislation legalizing medical marijuana in the Red Room at the Capitol on Thursday. AP Photo/Mike Groll

New York state legislation passed the Compassionate Care Act on Friday, officially making New York the 23rd state to legalize medical marijuana.

The much debated bill comes with some restrictions. It will prohibit smoking marijuana — rather patients will only be allowed to consume edibles and pills or vaporize marijuana. The no-smoking clause of the bill was a major demand of Governor Andrew Cuomo’s administration.

State lawmakers passed the bill on the last day of the legislated period. The state Assembly voted in favor of legalizing marijuana at 2:45 a.m. Friday morning. And the Senate voted to pass the bill on Friday afternoon after more than two hours of debate.

The Compassionate Care Act will cover illnesses such as cancer, AIDS, glaucoma, and multiple sclerosis, as well as children struggling with seizure disorders.

The bill won’t go into effect for 18 months while the health department establishes regulations, including establishing dispensaries. Also, the bill will undergo a seven-year trial period during which the legislators could pull the plug at any time.

The bill now goes to Gov. Cuomo’s desk to sign.

Senate galleries erupt as NY Senate votes 49-10 in favor of #medmar.

— Jon Campbell (@JonCampbellGAN)

#MedicalMarijuana has PASSED in NY Senate by a vote of [49-10] !!!!!!! #medmar #newyork