BERKELEY, Calif. — Since the birth of the Free Speech Movement half a century ago, this city has prided itself on its liberal values and policies, be they generous benefits for the needy or a look-the-other-way attitude toward marijuana use.

Now, the city is bringing those policies together with a new amenity for the poor here: free pot.

Beginning next August, medical marijuana dispensaries in this city will be required to donate at least 2 percent of their cannabis to low-income residents.

The City Council approved the requirement this summer — unanimously no less — with the hope of making the drug, which can sell for up to $400 an ounce at dispensaries, affordable for all residents.

Save 75% on a Digital Subscription Today

But the charity cannabis mandate, which city officials believe is the first such law, provoked a swift backlash from critics who mocked it as a tie-dyed fantasy in a city already famous for liberal experiments.

“Instead of taking steps to help the most economically vulnerable residents get out of that state, the city has said, ‘Let’s just get everybody high,’” said John Lovell, a lobbyist for the California Narcotic Officers’ Association.

Lovell said the free marijuana would sap patients’ motivation to look for work — after all, it is not a drug known for encouraging anyone to get off the couch — and could easily be resold on the street for profit by people who are short on money.

“I don’t see anything progressive about that,” Lovell said.

Tom Bates, the mayor of Berkeley, said the city was simply trying to ensure equal access to a drug he emphasized was medicine, useful for treating cancer pain and other maladies.

“There are some truly compassionate cases that need to have medical marijuana,” Bates said. “But it’s expensive. You hear stories about people dying from cancer who don’t have the money.”

Bates, a former state legislator and football player at the University of California, Berkeley, has also championed home brewing and organic vegetables on school menus. As for medical marijuana, “It’s a novel ideal to have it available to the poor,” he said. “Berkeley is sort of known for doing new things.”

Nearly 20 years after California became the first state to legalize medical cannabis, Berkeley’s new law highlights a paradox of marijuana as medicine: Whether it is sold illegally on the street or legally in a dispensary, access to the drug depends almost entirely on whether you can pay for it.

Almost anyone with $40 to spare can find a doctor who will prescribe cannabis to treat insomnia or migraines or low appetite or something else (but especially insomnia).

Yet, because marijuana remains illegal under federal law, insurance companies refuse to cover such treatments, which can run to hundreds of dollars per ounce for designer strains like All Star Sonoma Coma at local dispensaries.

It is not as if marijuana, medical or otherwise, is tough to find here, amid the vegan restaurants in downtown Berkeley and the smoke shops on Telegraph Avenue.

On a recent Wednesday afternoon, Joseph Skyler, an undergraduate at the university here, sat on the street with a group of homeless men, who were making trinkets and jewelry to sell to tourists. He was smoking marijuana that he said had been prescribed to him for insomnia.

“I believe in living a certain kind of lifestyle that’s very stress free,” Skyler, 23, said. “I’ve noticed that just from smoking, everyone calms down.”

No one else sitting with him had a medical cannabis card, though that had hardly stopped them from smoking marijuana.

Across the bay in San Francisco, David Theisen, 56, has relied on what he calls “compassion,” a popular term for free medical cannabis, to deal with insomnia.

After moving to the city several years ago, he quickly learned the compassion schedule at several dispensaries, which give away a few dried-out buds to the first comers once or twice a month.

“I can’t afford to buy it, but my need isn’t any less than anyone else’s,” he said.