Authorities in Los Angeles have shuttered 500 medical marijuana dispensaries since residents voted two years ago to cap the number of pot shops in the city at about 130, officials said on Thursday.

City Attorney Mike Feuer told reporters hundreds of the illegal businesses still operate, highlighting the challenges of reining in the dispensaries in Los Angeles, which is widely believed to have more pot shops than any U.S. metropolis.

To achieve the closures, Los Angeles officials have filed criminal and civil cases against some dispensary owners, and have sent letters threatening legal action against landlords who lease space to dispensaries, officials said.

The medical cannabis shops opened in the years after a vote by California residents in 1996 to permit medicinal use of the drug, which remains banned under federal law.

Twenty-three U.S. states allow medical pot, while four states and the District of Columbia have approved recreational marijuana use by adults.

Efforts to control the number of dispensaries in Los Angeles, the nation's second-largest city, have at times been compared with a game of whack-a-mole, as the owners of some shops move their businesses to escape enforcement.

The dispensaries, which are usually identified by a green medical cross posted on a storefront, have long drawn complaints from neighbors upset about the pungent smell and the risk of minors getting marijuana from dispensary customers.

But Feuer said the number of complaints has fallen over the last two years, in what he said was a sign the crackdown by his office is working. He declined to give an exact estimate of how many dispensaries still exist.

"While we have succeeded in a remarkable way up to this point, we are far from through," Feuer told a news conference.

Los Angeles residents voted in 2013 to cap the number of dispensaries at about 130, or roughly as many as registered with the city in 2007 when city leaders first tried to limit their numbers.

Under California's rules, the dispensaries cannot be located near schools, and must follow other regulations such as not having illuminated signs visible at night.

Estimates for the number of dispensaries currently operating in the city have varied widely.

A survey last September by the University of California, Los Angeles, found at least 410 in operation, said Bridget Freisthler, a professor of social welfare at the school.