The California Supreme Court on Monday ruled unanimously that cities and counties can ban medical marijuana dispensaries within their borders, a decision that could make some distributors go up in smoke.

In the ruling, the court said that state laws permitting the growth and distribution of medical marijuana — the first and most wide-reaching in the nation — did not pre-empt municipal laws prohibiting pot dispensaries. While marijuana distribution is clearly legal under the law, the court said, cities should still have the final say over whether such shops are right for them.

"Nothing in the [Compassionate Use Act of 1996] or the [Medical Marijuana Program] expressly or impliedly limits the inherent authority of a local jurisdiction, by its own ordinances, to regulate the use of its land, including the authority to provide that facilities for the distribution of medical marijuana will not be permitted to operate within its borders," the court ruled.

The decision upheld a 2010 Riverside, Calif., zoning ordinance that banned dispensaries there. Inland Empire Patients' Health & Wellness Center Inc., a Riverside-based dispensary, sued the city in hopes of overturning the ban and remaining in business. But lower courts and now the state's highest court have disagreed.

The focus on zoning ordinances may seem an odd way to counter pot dispensaries. But as pot shops rapidly sprouted over the past two decades, municipalities saw their zoning power as the most legally ironclad way to push back against them.

Californians passed Proposition 215 in 1996, removing state sanctions for patients who use cannabis under a doctor's recommendation. But the state Legislature failed to adopt regulations for the law, and some cities and counties were inundated with dispensaries before they even began to consider local rules.

Though the ruling focused on Riverside's ordinance in particular, it will have repercussions throughout the state, where some 200 local governments already have pot distribution bans on the books. According to The Associated Press, many localities passed such bans in just the past few years, and it's expected that more will soon follow suit now that the court has issued its much-anticipated ruling.

"Today's decision allowing localities to ban will likely lead to reduced patient access in California unless the state finally steps up to provide regulatory oversight and guidance," Tamar Todd, senior staff attorney for the Drug Policy Alliance, told the AP. "Localities will stop enacting bans once the state has stepped up and assumed its responsibility to regulate."

The country's leading pro-medical-marijuana group, Americans for Safe Access, which filed an amicus brief in the case, struck a more optimistic note about the ruling. While the court did restrict access to pot, the group said, it at least acknowledged that such dispensaries are legal — setting the stage for the Legislature to finally take action to better regulate the sale of weed and to increase its availability.

"While the California Supreme Court ruling ignores the needs of thousands of patients across the state, it simply maintains the status quo," said Joe Elford, the group's chief counsel. "Notably, the high court deferred to the state legislature to establish a clearer regulatory system for the distribution of medical marijuana, which advocates and state officials are currently working on."

California is one of 18 states to permit the sale of medical marijuana, but it's the only one without a legal basis for regulating the growth and sale of the drug. The California Legislature is considering two bills that would establish a statewide system for regulating marijuana dispensaries, one of which could render the Supreme Court's ruling moot by creating state-issued licenses that, critics say, would allow a would-be dispensary to open up shop anywhere with the state's blessing.