A slight marijuana smell wafted out as a steady stream of customers walked into a warehouse, its doors and windows covered by bars.

Suddenly, police swooped in.

“Sheriff’s department! Search warrant!” a Los Angeles County deputy shouted as the team thundered through the front door and began hauling out people in handcuffs.

The Compton 20 Cap Collective just south of Los Angeles that was raided earlier this spring is one of hundreds of illegal marijuana stores operating in LA County, where marijuana is legal for anyone 21 and over and retailers must be licensed to sell to them.

Broad marijuana legalization arrived in California at the start of the year. From the beginning, there was concern the legal market would be undercut by the massive black market that has existed for decades.

And that’s what’s happening. Nowhere is it a bigger problem than in the state’s biggest legal local marijuana market: Los Angeles County.

The number of outlaw dispensaries in the county greatly outnumbers about 150 licensed storefront retailers.

That reality is a buzzkill for those trying to play by the rules.

Legal pot shops are losing customers who can get products more cheaply at illegal outlets that don’t charge or pay taxes, said Adam Spiker, executive director of the Southern California Coalition, a trade organization that represents cannabis growers, distributors and dispensary owners.

It’s an “unfair competitive situation for licensed businesses,” Spiker said.

“I think if you turn the tables and took cannabis out of the equation — if it was another industry that didn’t have the stigmas — the government would do everything they could to give those licensed business paying taxes a level playing field.”

One of the selling points for legalization was it would generate a tax windfall for state and local governments. However, during the first quarter, the state reported only $34 million from cultivation and excise taxes, putting it on pace to fall well below the $175 million forecast for the first six months.

In April, state regulators sent nearly 1,000 cease-and-desist letters to cannabis businesses they suspected were operating illegally. An analysis by the trade publication Marijuana Business Daily found about 64 percent of the businesses were in the Los Angeles metropolitan area.

Last month, the Los Angeles city attorney’s office charged 142 people as part of a crackdown on illegal dispensaries. It also sent out cease-and-desist letters but declined to say how many.

Los Angeles County boasts the nation’s largest sheriff’s department, but even it has nowhere near the manpower to take down all the illegal pot shops. A task force overseen by Lt. Frank Montez raids an average of one dispensary a week.

However, the voter-approved ballot measure legalizing cannabis in California included a provision that made possessing more than 28.5 grams only a misdemeanor. That means officers can seize businesses’ cash and marijuana, but employees and owners rarely face jail, and illegal operations often quickly reopen.

“It’s a money-lucrative business so there are people willing to take the risk,” said Capt. Holly Francisco, who commands the sheriff’s department’s narcotics unit.

Montez sees his work as more than code enforcement. Marijuana sold illegally may be tainted with illegal pesticides and other harmful substances. And licensed marijuana shop owners who pay their taxes should have a fair playing field, he said.

“When you have an illegitimate, illegal dispensary operating, that not only hurts the industry as a whole but that really hurts the community,” Montez said.

At the Compton store, a sign above a security window says customers must be at least 18 and have a physician’s recommendation to buy medical marijuana and be 21 and have a valid photo ID for anything else. Like many others, the shop operated in plain sight and advertised online, including on WeedMaps, a go-to website for people looking to buy cannabis.

Inside, whiteboards on dirt-smudged walls advertised the prices for different types of cannabis and concentrates.

Cartridges for vapor pens and “Shatter,” a honey-like oil containing cannabis extract, cost between $15 and $30. Large display cases held jars of branded marijuana strains — 28 grams of “Purple Dragon” sold for $160.

“People out here on the street are thinking it is a legitimate operation and are smoking this cannabis with all these dangerous pesticides, and they are really killing themselves,” Montez said.

Some illegal pot shops look so legitimate that customers may not even realize they are illegal unless they figure out they aren’t being charged tax. But like any shopper looking for the best deal, plenty know these places are illegal and go because it’s cheaper.

While some illegal LA County pot shops grow their own plants, many are supplied by illegal grows in the hills of Northern California, long a major source of all U.S. pot.

Lake County, about 125 miles (201 kilometers) north of San Francisco, is home to many such grows because of its topography, which allows pot farmers to easily hide large operations. It has an abundance of federal and state forests and land where cartels set up operations.

Like the LA County Sheriff’s Department, Lake County lacks the manpower to put much of a dent in illegal operations.

Deputies patrol on the ground and in helicopters, and last year they destroyed about 250,000 plants and arrested 46 people for illegal grows, Sheriff Brian Martin said.

He has no estimate for the number of illegal grows in the county but is confident the hundreds of thousands of plants deputies chop down each year are “just the tip of the iceberg.”

Martin said his short-staffed department has assigned a single a detective full-time to marijuana eradication. He counts on help from state and federal agencies, but they too have their priorities.

“It’s all about manpower,” he said. “No one has enough of it.”

___

Associated Press writer Paul Elias in San Francisco contributed to this report.

___

Mike Balsamo is a member of AP’s marijuana beat team. Follow him on Twitter at twitter.com/MikeBalsamo1 . Find complete AP marijuana coverage here: apnews.com/tag/LegalMarijuana .