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.