OAKLAND, Calif. -- Customers lined up early to purchase recreational marijuana legally for the first time in California as the new year brought broad legalization some two decades after the state was the first to allow pot for medical use.

Jeff Deakin, 66, his wife Mary and their dog waited all night and were first in a line of 100 people when Harborside dispensary, a longtime medical pot shop in Oakland, opened at 6 a.m. and offered early customers joints for a penny and free T-shirts that read "Flower to the People -- Cannabis for All."

"It's been so long since others and myself could walk into a place where you could feel safe and secure and be able to get something that was good without having to go to the back alley," Deakin said. "This is kind of a big deal for everybody."

The nation's most populous state joins a growing list of other states, and the nation's capital, where so-called recreational marijuana is permitted even though the federal government continues to classify pot as a controlled substance, like heroin and LSD.

California voters in 2016 made it legal for adults 21 and older to grow, possess and use limited quantities of marijuana, but it wasn't legal to sell it for recreational purposes until Monday.

Finding a retail outlet to buy non-medical pot in California won't be easy -- at least initially. Only about 90 businesses received state licenses to open New Year's Day. They are concentrated in San Diego, Santa Cruz, the San Francisco Bay Area and the Palm Springs area.

Los Angeles and San Francisco are among the many cities where recreational pot will not be available right away because local regulations were not approved in time to start issuing city licenses needed to get state permits. Meanwhile, Fresno, Bakersfield and Riverside are among the communities that have adopted laws forbidding recreational marijuana sales.

Just after midnight, some raised joints instead of champagne glasses.

Johnny Hernandez, a tattoo artist from Modesto, celebrated by smoking "Happy New Year blunts" with his cousins.

"This is something we've all been waiting for," he said. "People might actually realize weed isn't bad. It helps a lot of people."

Berkeley Mayor Jesse Arreguin and state Sen. Nancy Skinner were on hand for a ribbon-cutting ceremony as his city began selling marijuana legally. Customers began lining up before dawn Monday outside Berkeley Patients Group, one of the oldest dispensaries in the nation.

Los Angeles officials announced late last month that the city will not begin accepting license applications until Jan. 3, and it might take weeks before any licenses are issued. That led to widespread concern that long-established businesses would have to shut down during the interim.

However, attorneys advising a group of city dispensaries have concluded that those businesses can continue to legally sell medicinal marijuana as "collectives," until they obtain local and state licenses under the new system, said Jerred Kiloh of the United Cannabis Business Association, an industry group.

It wasn't immediately clear how many of those shops, if any, would be open New Year's Day.

"We are trying to continue to provide patient access," said Kiloh, who owns a dispensary in the city's San Fernando Valley area. With the new licensing system stalled in Los Angeles "my patients are scared, my employees are scared."

The status of the Los Angeles shops highlights broad confusion over the new law.

State regulators have said shops must have local and state licenses to open for business in the new year. But the city's top pot regulator, Cat Packer, told reporters last month that medicinal sales can continue to consumers with a doctor's recommendation until new licenses are issued.

The state banned "loco-weed" in 1913, according to a history by the National Organization for the Reform of Marijuana Laws, the pot advocacy group known as NORML. The first attempt to undo that by voter initiative in 1972 failed, but three years later felony possession of less than an ounce was downgraded to a misdemeanour.

In 1996, over the objections of law enforcement, President Clinton's drug czar and three former presidents, California voters approved marijuana for medicinal purposes. Twenty years later, voters approved legal recreational use and gave the state a year to write regulations for a legal market that would open in 2018.

Today, 29 states have adopted medical marijuana laws. In 2012, Colorado and Washington became the first states to legalize recreational marijuana. Since then, five more states have passed recreational marijuana laws, including Massachusetts, where retail sales are scheduled to begin in July.

Even with other states as models, the next year is expected to be a bumpy one in California as more shops open and more stringent regulations take effect on the strains known as Sweet Skunk, Trainwreck and Russian Assassin.

The California Police Chiefs Association, which opposed the 2016 ballot measure, remains concerned about stoned drivers, the risk to young people and the cost of policing the new rules in addition to an existing black market.

"There's going to be a public-health cost and a public-safety cost enforcing these new laws and regulations," said Jonathan Feldman, a legislative advocate for the chiefs. "It remains to be seen if this can balance itself out."

At first, pot shops will be able to sell marijuana harvested without full regulatory controls. But eventually, the state will require extensive testing for potency, pesticides and other contaminants. A program to track all pot from seed to sale will be phased in, along with other protections such as childproof containers.

Jamie Garzot, founder of the 530 Cannabis shop in Northern California's Shasta Lake, said she's concerned that when the current crop dries up, there will be a shortage of marijuana that meets state regulations. Her outlet happens to be close to some of California's most productive marijuana-growing areas, but most of the surrounding counties will not allow cultivation that could supply her.

"Playing in the grey market is not an option," Garzot said. "California produces more cannabis than any state in the nation, but going forward, if it's not from a state-licensed source, I can't put it on my shelf. If I choose to do so, I run the risk of losing my license."

In 2016, the state produced an estimated 13.5 million pounds of pot, and 80 per cent was illegally shipped out of state, according to a report prepared for the state by ERA Economics, an environmental and agricultural consulting firm. Of the remaining 20 per cent, only a quarter was sold legally for medicinal purposes.

That robust black market is expected to continue to thrive, particularly as taxes and fees raise the cost of retail pot by as much as 70 per cent.

------

Melley reported from Los Angeles. Associated Press writers Christopher Weber, Michael R. Blood and Michael Balsamo contributed to this report from Los Angeles.