INDIO, Calif. -

A Riverside County judge ruled in favor of a medical marijuana dispensary on Tuesday and ordered the city of Rancho Mirage to have a building inspected for code violations and to issue a certificate of occupancy

Desert Heart Collective, which is owned by four people, opened in 2010 and was later shut down by the city. The owners filed a $2 million lawsuit against Rancho Mirage on Feb. 3, 2011.

Rancho Mirage law prohibits storefront dispensaries "due to the significant negative secondary effects that such dispensaries have been found to create -- such as increased crime," City Attorney Steve Quintanilla said in a written statement.

Quintanilla and attorneys for Desert Heart Collective argued Tuesday before Riverside County Superior Court Judge Randall D. White on Desert Heart's motion for a writ of mandate requiring the city to conduct a code inspection and consider issuing a certificate of occupancy to the collective, according to court papers.

In opposing the motion, city attorneys argued that requiring the city to issue the permit would "affirmatively authorize and entitle a medical marijuana dispensary to operate in the city."

"Such an affirmative authorization is not contemplated by state law, and would potentially subject the city to federal prosecution. The city should not be forced to issue any entitlements that would ostensibly authorize a federally designated illegal use," city attorneys wrote.

Attorneys for the collective countered that issuing the permit gives the permit holder "the option to conduct an activity."

"It does not constitute a command to conduct the activity. Moreover, simply issuing the permit does not involve handling marijuana or any other activity that is illegal under federal law," attorneys for the collective wrote in their reply to the city's opposition.

White had previously ruled that Rancho Mirage's ban on medical marijuana dispensaries was invalid without resolving the damages claim. In January, he ordered the collective's owners to produce financial records and evidence of their claims. Quintanilla said the city will appeal White's ruling on its dispensaries ban.

He said the California Supreme Court is reviewing cases involving the rights of four cities -- Riverside, Long Beach, Dana Point and Upland -- to regulate or prohibit dispensaries. A decision is not expected for about a year, he said.

California law allows dispensaries to operate on a nonprofit basis. Riverside County has a ban on storefront cannabis clubs and is in the process of shutting several down in unincorporated communities.