The City’s 21 licensed medical marijuana dispensaries are all illegal, according to a court filing by District Attorney George Gascón that could portend a seismic shift in San Francisco cannabis policy.

City law allows medical marijuana to be bought in businesses called dispensaries and delivered to patients who have been prescribed marijuana by a licensed physician. Dispensaries must acquire business licenses and seller’s permits from the state Board of Equalization before receiving city Department of Public Health permits to sell marijuana.

Grow guide for marijuana beginners.

Yet in December, a woman was arrested for making a delivery on behalf of Mr. Nice Guy, a city-licensed dispensary whose storefront was shut down under pressure from the federal Justice Department. Police said the woman was arrested with $631 in cash, more than 100 plastic bags of dried marijuana buds and hashish, and 48 “edibles” — marijuana-laced cookies, brownies, or other treats.

Despite being presented with paperwork showing that the woman and buyer were licensed patients and that she was working on behalf of a registered dispensary, the DA charged her with two felony counts for marijuana possession and sales, said her attorney, former District Attorney Terence Hallinan.

In a legal brief, Gascón argued that the law is not on her side.

“While California’s medical marijuana laws may be complex, the law is clear that all sales of medical marijuana are illegal,” Gascón wrote. “The … shell game that continues to be played with medical marijuana immunities does not change that conclusion.”

Gascón’s office cites the 1996 Compassionate Use Act as well as state court decisions to make his argument, which says medical marijuana patients must “participate directly in the cultivation of marijuana” to enjoy protection under the law.

Sticky, sweet-smelling sublime bud!

“This means that people with AIDS have to be out digging in the dirt to enjoy protection under the law,” countered former District Attorney Terence Hallinan, who is representing the woman in court. “This is impossible.”

The inconsistent policies — with one county agency calling illegal what another one issues permits for — is “emblematic of the ongoing disconnect in San Francisco with regard to the city’s approach to medical cannabis,” complained Assemblyman Tom Ammiano, D-San Francisco.