(CNN)California inmates can now legally possess marijuana in their cells -- as long as they don't use it, a state appeals court has ruled.
California prisoners can now legally possess pot. They just can't smoke it
A three-judge panel on Tuesday overturned the convictions of five Sacramento men who were found with marijuana in their cells.
The California penal code criminalizes the smoking and ingesting of cannabis in prison, but it doesn't address possession, Presiding Justice Vance Raye wrote.
Before this ruling, prison inmates faced the possibility of an additional eight years behind bars for simple marijuana possession on top of the time served for their initial crime.
California voters in 2016 legalized recreational possession of less than an ounce of marijuana, with no exception for people who are incarcerated.
The court cited Proposition 64 guidelines in noting that "possession of less than an ounce of cannabis in prison is no longer a felony," adding, "smoking or ingesting cannabis in prison remains a felony."
Marijuana possession should still be considered a violation of prison rules -- like having cell phones or alcohol -- state Attorney General Xavier Becerra, a Democrat, had argued. But the judges pushed back, saying the AG "uses arcane rules" and "twists the meaning" of the Proposition 64 language.
The judges also dismissed Becerra's argument that marijuana possession would be an added stress on prison staff.
"We want to be clear that drug use and sales within state prisons remains prohibited," California Department of Corrections and Rehabilitation spokeswoman Vicky Waters said.
"CDCR is committed to providing a safe, accountable environment for prisoners and staff alike and we plan to evaluate this decision with an eye towards maintaining health and security within our institutions," she added.
Becerra's office must decide whether to appeal the decision to the California Supreme Court.