SACRAMENTO, Calif. (AP) — A California appeals court says it’s legal to have small amounts of marijuana in prison — so long as inmates don’t inhale.

The 3rd District Court of Appeal ruled that California voters legalized possession of less than an ounce (28 grams) of cannabis by adults 21 and over in 2016, with no exception even for those behind bars.

“Smoking or ingesting cannabis in prison remains a felony.”

Court ruling

But the court says state law does prohibit smoking cannabis in prison. Prison officials can also still punish possession as a rules violation.

“According to the plain language of … Proposition 64, possession of less than an ounce of cannabis in prison is no longer a felony,” the court ruled Tuesday. “Smoking or ingesting cannabis in prison remains a felony.”

The court overturned the Sacramento County convictions of five inmates who had been found with marijuana in their prison cells.

RELATED STORY

Los Angeles to Erase 50,000 Criminal Cannabis Convictions

“The voters made quite clear their intention to avoid spending state and county funds prosecuting possession of less than an ounce of marijuana, and quite clear that they did not want to see adults suffer criminal convictions for possessing less than an ounce of marijuana,” Sacramento County Assistant Public Defender Leonard Tauman said in an email. The appeals court “quite properly honored what the electorate passed.”

“The fact that the Attorney General may not agree with the voters does not empower us to rewrite the initiative.”

Court ruling

Attorney General Xavier Becerra’s office said it is reviewing the ruling and did not say if he will appeal.

“We want to be clear that drug use and sales within state prisons remains prohibited,” said corrections department spokeswoman Vicky Waters. She said the department “is committed to providing a safe, accountable environment for prisoners and staff alike and we plan to evaluate this decision with an eye toward maintaining health and security within our institutions.”

The three-judge panel rejected the state’s argument that guards will lose control over prisons if inmates are free to possess small quantities of marijuana, noting that possession can still be punished as a rules violation with longer prison terms or a reduction in privileges.

RELATED STORY

Racial Arrest Disparities Got Worse After Legalization, Study Finds

While prison officials can still punish inmates for violating the rules, “this ruling will prevent inmates from having years added to their sentences for simple possession, reducing overcrowding and saving $50,000-75,000 a year in unnecessary costs,” said Assistant Public Defender David Lynch.

The judges scolded the attorney general’s office for a counter-argument it said “uses arcane rules” and “twists the meaning of the words of the statute.”

Becerra’s office argued that the court’s reading of the law was absurd because it in effect allows controlled substances into prisons. But the court noted that it previously ruled that it’s not illegal for inmates to have properly prescribed medications or medical marijuana behind bars — though it may be against the rules.

RELATED STORY

Missouri Police Searched a Hospitalized Cancer Patient for Cannabis. Here’s Why

“The Attorney General raises the same hackneyed and losing arguments in each case involving contraband in jails or prisons,” the judges wrote.

Lawmakers held “an over abiding consensus” in the 1940s that drug use by inmates was “the ultimate evil,” they wrote. But those old laws belie “a gradual change in attitude” first toward medical and eventually toward recreational marijuana.

“As a matter of public policy, his position may be sound,” the judges wrote. “The fact that the Attorney General may not agree with the voters does not empower us to rewrite the initiative.”

They ultimately concluded that “a result is not absurd because the outcome may be unwise.”