New York became the 23rd state to legalize medical marijuana Friday afternoon after the state Senate passed the Compassionate Care Act, 49-10.

But the legislation doesn’t allow patients to smoke medical marijuana. They can ingest it, inhale it through vapors or access it through oils. It also won’t go into effect until at least the end of 2015.

The bill was passed on the last day of New York’s legislative session. The state Assembly passed the legislation early Friday morning after a long debate that included emotional testimony about marijuana's therapeutic potential to help patients with cancer, AIDS, epilepsy and other serious diseases.

"The fact of the matter for me remains this: People are suffering right now. That suffering can be alleviated as soon as we make this available to them," said Sen. Ted O'Brien, a Democrat from upstate Monroe County.

Gov. Andrew Cuomo has already pledged to sign the bill.