SALT LAKE CITY (AP) — The Mormon church joined lawmakers, the governor and advocates to back a deal Thursday that would legalize medical marijuana in conservative Utah after months of fierce debate.

The compromise comes as people prepare to vote in November on an insurgent medical marijuana ballot initiative that held its ground despite opposition from The Church of Jesus Christ of Latter-day Saints.

Gov. Gary Herbert said he'll call lawmakers into a special session after the midterm election to pass the compromise into law regardless of how the initiative fares. If it passes, it will be revised under the terms of the deal. It if fails, the Legislature would consider a law under the new framework.

The agreement in such a conservative state underscores the nation's changing attitude toward marijuana. Medical use now is legal in more than 30 states and also is on the November ballot in Missouri. So-called recreational marijuana goes before voters in Michigan and North Dakota. If passed, it will be a first for a Midwestern state.

The Utah-based faith had opposed the ballot proposal over fears it could lead to more broad use, but ranking global leader Jack Gerard said they're "thrilled" to be a part of the effort to "alleviate human pain and suffering."

Though it still must go to a vote, the deal has the key backing of both the church and leaders of the Republican-dominated Legislature, who said the regulations in the hard-won agreement have their seal of approval. Unlike the ballot initiative, the compromise won't allow people to grow their own marijuana if they live too far from a dispensary. It also doesn't allow certain types of edible marijuana that could appeal to children, like cookies and brownies.

"I will do everything in my power to ensure this compromise passes in the special session," said Utah Senate president Wayne Niederhauser.

Medical marijuana advocates are backing the deal to avoid wrangling and uncertainty that could continue if the ballot initiative passes.

Story continues

"There will be medical cannabis here in our day in Utah," said advocate DJ Schanz. The two sides agreed to scale back media campaigns supporting and opposing the ballot measure known as Proposition 2.

Not all medical-marijuana advocates were convinced: Christine Stenquist with the group Truce said she remains skeptical about the deal and urged continued support for the ballot proposal.

Smoking marijuana would not be allowed under the ballot proposal. It instead allows edible forms, lotions or electronic cigarettes.

While The Church of Jesus Christ of Latter-day Saints opposed the ballot measure, leaders also made first-ever public statement supporting the use of medical marijuana if prescribed by a doctor and dispensed by a pharmacy. The church's positions carry outsized sway in its home state.

The faith had long frowned upon medical marijuana use because of a key church health code called the "Word of Wisdom," which prohibits coffee as well as alcohol, tobacco and illegal drugs.