SANTA ANA — An Orange County Superior Court judge next week is expected to rule on whether Costa Mesa can ban marijuana dispensaries.

Judge David R. Chaffee will rule on whether to permit the city to shut down five marijuana dispensaries on Fair Drive as nuisances, but his decision could have broader implications, said Elena Gerli of Jones & Mayer, the law firm Costa Mesa city contracts with.

If Chaffee dismisses the city's argument that the dispensaries are nuisances because Costa Mesa has no zoning that allows them, he essentially will be ruling that California cities cannot ban dispensaries permitted under the Compassionate Use Act of 1996, Gerli said.

The city's position, however, is that amendments to state code that took effect Jan. 1 allow that very thing: marijuana dispensary regulation at the local level. Costa Mesa has an ordinance banning dispensaries under zoning law that considers them a nuisance. The defense argues state law only allows for strict regulation, not an outright ban.

The businesses in question: names like OC Wellness, Illuminade and Herban Elements, which is owned by former City Council candidate Sue Lester, were shut down in April along with seven massage parlors in the same business complex.

Chaffee upheld the bans against the massage parlors — which police raided after conducting a months-long investigation into prostitution — but told the city's attorneys they would need to bolster their arguments against the marijuana businesses.

The city's attorneys said little in court but argued in a case filing that the new state law supported the city's ban.

The arguments by the dispensaries' defense attorneys are twofold: Costa Mesa authorities targeted the five because of their location — tucked in a business complex among the massage parlors — and simply because they dispense marijuana.

Costa Mesa code enforcement officers slapped several of the businesses with building code violations when they shut them down. Chaffee on Friday ordered them to rectify the violations. That, in itself, is a tangled web, attorneys were overheard saying outside the courtroom.

Dispensary owners up to now have not been able to get code enforcement officers to come out to the businesses to check on the changes. Dispensaries are banned, after all, so code enforcement officers can't sign off on changes to something that shouldn't be there in the first place, attorneys said.

Two weeks ago Chaffee allowed the dispensaries to reopen pending his ruling next week.