Gov. Kay Ivey on Monday signed legislation creating an Alabama medical marijuana program, ending a three-year fight and reflecting a notable transformation on the issue in a conservative state.

The governor signed the bill Monday afternoon, 11 days after the Legislature passed the law.

"On the state level, we have had a study group that has looked closely at this issue, and I am interested in the potential good medical cannabis can have for those with chronic illnesses or what it can do to improve the quality of life of those in their final days," Ivey said in a statement.

The legislation, sponsored by Sen. Tim Melson, R-Florence, would allow the use of medical marijuana for about 15 different conditions, including cancer, motor neuron disease, depression, and sickle-cell anemia. Individuals seeking medical cannabis would need a recommendation from a physician to use marijuana, saying that traditional therapies have not worked. The patient would also have to register with the state and obtain a special medical cannabis card, costing no more than $65.

"We’ve got 12 to 15 months before this will be a product out there," Melson said Monday evening. "Maybe more to 15. We’ll have time to address anything with an amendment if things pop up that we haven’t thought of."

Medical marijuana could be grown in up to 12 different locations and distributed in another 12 areas. The law bans smoking, vaping or consuming medical marijuana in baked goods. Medical cannabis could be taken as tablets, capsules, gummies or vaporized oils. The law also requires cannabis gummies to have a single flavor.

The bill does not allow recreational marijuana.

Melson's legislation passed the Senate with little debate in February; the chamber passed similar bills in 2019 and 2020. But the legislation faced a gauntlet in the House, where House leaders sent the bill through two different committees, instead of the usual one. The committees made more than a dozen changes to the bill, though the core of the legislation remained unaffected.

Alabama Attorney General Steve Marshall opposed the bill, as did 23 district attorneys who made claims unproven to this point about marijuana leading to the onset of schizophrenia. Debate over the legislation consumed 11 hours over two days, with opponent saying the bill could open the door to recreational marijuana. But the legislation passed by a comfortable 68 to 34 margin.

Medical marijuana bills have been filed in the Alabama Legislature for at least 15 years. The Legislature approved Carly's Law in 2014 and Leni's Law in 2016, which expanded the availability of cannibidiol (CBD) oil for children enrolled in a study of seizures at the University of Alabama Birmingham. Many people who use marijuana to manage their pain testified at a public hearing in 2019, and legislators shared their own stories during a debate on May 4.

"I think we just educated them as much as anything," Melson said, adding that there were "a lot of good articles" about the potential benefits of medical cannabis.

Dustin Chandler, whose daughter Carly inspired Carly's Law, supported the medical marijuana legislation. Carly, who suffered hundreds of seizures a day, has improved with CBD oil, and Chandler said he supported the medical marijuana bill because he knew the sense of hopelessness many families with struggling members may experience.

"The intention was just to help people," he said. The opposition thinking it’s the next step to open up the gates … that was not the intention. The intention was always to help who we can, and do it the right way."

It is not clear when medical cannabis will be available. The bill creates a state commission to regulate cultivation and distribution of medical cannabis, and provides timetables for training of physicians and licensing. Patients will probably not be able to get medical cannabis before the fall of 2022.

Melson said some elements, like physician training, could take place as soon as a program is in place.