San Diego will have a fully legal and regulated marijuana industry including pot farms, factories making edibles and retail storefronts selling the drug to both medical and recreational customers.

The City Council voted 6-3 on Monday to legalize local cultivation, manufacturing and testing of marijuana when new state laws take effect in January.

The council also agreed earlier this year to allow legally approved medical marijuana dispensaries to expand their sales to recreational customers. The city has approved 17 such businesses and 11 have begun operating.

The approval came despite strong objections from Police Chief Shelley Zimmerman, who warned of significant threats to public safety that she said couldn’t be outweighed by new tax revenue from the highly profitable industry.

The council majority said, however, that creating a local supply chain for the city’s dispensaries would boost the economy, create jobs and improve the quality and safety of local marijuana by eliminating the need to truck it in from elsewhere.

They also said it would prevent a local “black market” of unregulated cultivators and manufacturers that would emerge if the city outlawed those activities.

The council also took the less controversial step of allowing marijuana testing facilities in the city. Testing of for-sale marijuana will be required under new state laws prompted by California voters approving Proposition 64 last November.

The only other cities in the county that allow dispensaries are La Mesa and Lemon Grove, where voters forced the hands of city leaders by approving ballot measures last November. And only La Mesa has indicated it may allow cultivation.

The council also eliminated a proposed cap of two cultivating, manufacturing and testing businesses per council district, which would have allowed a maximum of 18 in the city. Instead, the council set a citywide cap of 40 such businesses.

Another proposal from staff that the marijuana industry opposed was a rule prohibiting such businesses from opening within 100 feet of each other or dispensaries. The council also eliminated that rule.

Councilman Chris Ward said the decision was obvious to him.

“Having sound policy and regulations in place will allow the city to enforce its rules and assist the cannabis industry in regulating itself,” he said. “Would we tell Stone Brewery that we wanted them to manufacture everything in Riverside County and truck it down? Would we tell Ballast Point they can only grow their hops up in Humboldt?”

Councilwoman Barbara Bry said creating a legalized local supply chain was crucial.

“If we don’t allow all parts of the supply chain in San Diego we are merely enabling a large black market,” she said. “San Diego consumers are counting on us to provide them a safe product.”

Councilwoman Lorie Zapf, who joined with colleagues Scott Sherman and Chris Cate to cast the “no” votes, said she shared the concerns expressed by Chief Zimmerman.

“I think we should listen to our police chief,” said Zapf. “We were elected if nothing else to oversee public safety and we’re just absolutely going down the wrong road.”

David Garrick has covered San Diego City Hall since early 2014 for The San Diego Union-Tribune. Before that, he covered North County for 16 years for the Union-Tribune, North County Times and Pomerado Newspapers. Garrick graduated from Coronado High School and UC Berkeley and received a master’s in journalism from New York University. He spent his early newspaper career in New York City.