A federal magistrate judge on Monday ruled that a medical-marijuana dispensary that bills itself as the world's largest can continue to operate, at least for now, in Oakland and San Jose despite a bid by federal prosecutors to shut it down.

The ruling marks the latest move in a tug-of-war between local and federal authorities over medical marijuana dispensaries and over Harborside Health Center, which was featured on the Discovery Channel reality TV show "Weed Wars."

Harborside's landlords are seeking to evict the store under pressure from federal prosecutors as part of the U.S. government's crackdown on what it deems to be illegal pot shops in California and the West.

But U.S. Magistrate Judge Maria-Elena James ruled that the government, not the landlords, must move to evict Harborside for its alleged violation of the federal Controlled Substances Act.

The landlords "are attempting to use a procedural rule in a civil forfeiture proceeding to bring what amounts to an enforcement action ... against Harborside," the 17-page ruling said. "This is a measure which the Government - the entity charged with enforcing the statute - has elected not to pursue."

The city of Oakland in October sued the federal government in an effort to allow Harborside to continue selling marijuana to its 100,000 patients. Oakland officials warned that a shutdown would lead to a "health crisis."

The city expects to collect $1.4 million in medical-pot sales taxes this year.

"This is a significant victory for the City of Oakland and its 400,000 citizens, for thousands of cannabis patients, and for the Harborside dispensary," Cedric Chao, a lawyer representing the city pro bono.

"With today's ruling, we can develop Oakland's case in a logical way and tee up the federal government's actions for examination by the federal judiciary," he said.

Eighteen states, including California, and the District of Columbia allow medical marijuana.

But U.S. prosecutors argue that federal law takes precedence over state law and sought to shut down Harborside by trying to seize its landlords' properties.

The judge will continue to hear both the landlords' eviction case against Harborside and Oakland's lawsuit blocking the eviction.