ST. PAUL, Minn. (AP) — Minnesota has joined the ranks of states where marijuana is a legal medicine.

Gov. Mark Dayton on Thursday signed legislation that sets up a restrictive medical marijuana program. It has tight controls over qualifying conditions and the form its available in. People won't be able to smoke it legally or access it in leaf form.

“I thank everyone who worked together to craft and pass this legislation.” said Governor Dayton. “I pray it will bring to the victims of ravaging illnesses the relief they are hoping for.”

The compromise bill upset some medical marijuana advocates, who say many people who need relief won't get it. But legislative backers say it is a positive first step that satisfied concerns of law enforcement and doctor groups.

The law sets up a task force to assess the impact of medical cannabis.

If all goes as planned, the drug will be available in pill and oil form in mid-2015.