RIVERSIDE (AP) — A judge ruled Friday that Riverside County can’t close medical marijuana dispensaries in unincorporated areas because the move doesn’t give the shops any room to operate legally under state law.

Judge Ronald Taylor issued his ruling regarding the county’s ban on pot clinics, and a county attorney vowed to appeal it, the Riverside Press Enterprise reported.

READ MORE: Kings Lose To Flames 3-2, Markstrom Makes 40 Saves

“Today is one of the rare situations where the court didn’t get it right,” said lawyer Jeffrey Dunn, who represents the county.

Taylor’s ruling adds to an array of conflicting court decisions across the state about whether municipalities can prohibit pot shops.

An appeals court in Southern California recently struck down Los Angeles County’s 2-year-old ban on dispensaries, ruling that state law allows cooperatives and collectives to grow, store and distribute pot. However, in a separate case, an appeals court said federal law pre-empts municipalities from allowing dispensaries.

Pot clinic advocates say government bans disregard the state law passed by voters in 1996 that allows the use of medical marijuana with a doctor’s recommendation.

READ MORE: Statements From Los Angeles Community College District and California Community Colleges Chancellor’s Office

Attorneys for cities and counties counter that local zoning laws can be used to ban dispensaries.

The state Supreme Court has decided to hear the various cases but has yet to set a hearing date.

More than 175 California cities from Calistoga to Camarillo and 20 counties already have banned retail pot shops, according to the medical marijuana advocacy group Americans for Safe Access.

Last week, the city of Los Angeles ordered hundreds of pot storefronts to close until the state’s high court issues a ruling.

MORE NEWS: First Case Of Omicron Variant Detected In LA County

(© Copyright 2012 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)