California’s Wild West of medical marijuana is about to be tamed, on the eve of a historic vote that could greatly expand recreational use of cannabis.

Just as labeling allows consumers to trust the difference in potency between a strawberry-rosé spritzer and 190-proof grain alcohol, new state regulations will demand testing, labeling, certification and licensing medical marijuana — every step along the way, from seed to sale.

var _ndnq = _ndnq || []; _ndnq.push([’embed’]);

The new rules, starting in 2018, could also boost pot prices, as businesses face more paperwork, permits, licenses and other new requirements, driving up their costs — and likely pushing some mom-and-pop growers and dispensaries out of business.

While the changes may complicate doing business, the goal is simple, said Lori Ajax, the state’s first weed czar.

“We are looking to protect patients, the public and the environment,” Ajax said during a “pre-regulatory” meeting in Oakland last week for the commercial cannabis industry hosted by her fledgling state Bureau of Medical Cannabis Regulation.

“If you are engaged in commercial medical cannabis, you need a license,” said Ajax, who has never used cannabis but has decades of experience administering the state’s notoriously complex alcohol laws with the Department of Alcoholic Beverage Control.

Two decades after the Golden State pioneered the legal use of medical marijuana through Proposition 215, its vast cannabis industry has been operating under a patchwork of local regulations — or outside the law altogether.

This local control is very different from the approach taken by other states, such as Colorado, Washington and Oregon, which put the state in charge from the very beginning.

“California has always done things its own way,” said attorney Amanda Ostrowitz of CannaRegs, which tracks marijuana laws and regulations around the nation.

But while local control has worked well in some places, such as San Jose and Oakland, other communities have struggled to keep tabs on businesses that operate on the margins of legitimacy.

For instance, San Mateo County has about 40 pot delivery services that are illegal under county codes, said Ryan P. Mullane, a Santa Clara-based criminal defense and cannabis licensing attorney. In Los Angeles, overwhelmed police say that public safety deserves far more attention than unlicensed dispensaries.

In the remote farms of Humboldt County, where workers — many of them young women — make thousands of dollars trimming marijuana buds, there are stories of sexual abuse and exploitation. Others report frightening encounters with outlaws on the lam.

“Cities don’t have the capacity to enforce the same robust regulations that the state can,” said Ostrowitz, who is based in Denver. “The state has more money to run these programs and enforce them.”

The sweeping new California rules create an extensive, heavily regulated system for growing, testing and selling medical marijuana — and would become the template if voters pass Proposition 64, which would legalize recreational pot.

The change was signed into law last October by Gov. Jerry Brown. Local governments are still free to pass more restrictive laws. San Jose and Oakland, which already tax dispensaries and limit where they are located, will both keep their regulations in place. A dual-licensing system requires the industry to obtain both state and local permits.

The federal government — which still considers cannabis a Schedule I illegal drug, alongside heroin and LSD — won’t crack down on pot dispensaries that follow the local and state rules, as long as those businesses stay within California’s borders.

Two other state agencies also will be responsible for the new marijuana oversight, including the Department of Food and Agriculture, which will license growers, and the Department of Public Health, which will license manufacturers.

The state held workshops in seven cities with members of the industry to guide how its final regulations are written. It will also offer a written comment period and public hearings.

The new regulations come as 60 percent of California voters tell pollsters that they favor passage of Proposition 64. The measure would boost sales in an industry already valued at $2.7 billion a year, according to The ArcView Group, a marijuana market research firm. If legalized for recreational use, sales are projected to jump to $6.6 billion by 2020.

“If you have state regulations, hopefully you can control the bad things while emphasizing the good things,” said Mullane, the cannabis licensing attorney.

However, the looming rules have put the cannabis industry into a tailspin, forcing a freethinking and entrepreneurial community to wade through 300 pages of regulations.

At the recent Oakland event, where Ajax and her officers solicited feedback, swarms of people circled her with questions.

One major concern is a rule that requires growers to hire an independent distributor to take products to a testing lab and certify the results. Only then can growers sell the certified marijuana to dispensaries.

“Everything has to be tested,” said Ostrowitz, the CannaRegs attorney.

And no longer can buyers and sellers just drive to some random location to exchange weed for cash. Now a state-issued “transportation manifest” is required for commercial shipments.

There are also complaints about the cost of licensing growers, which could favor big businesses over small cultivators with a few plants in their garage.

“Now you’re telling them they need $20,000 to get a license and $100,000 to renovate for electrical permits and pay 20 percent in taxes,” Mullane said. “That is the biggest challenge — getting participation from small to medium-sized actors.

“A lot of people are used to operating outside the law.”