SAN FRANCISCO (AP) — A Northern California court ordered police to return a small amount of marijuana seized from a suspect’s backpack during an arrest for disturbing the peace.

The San Francisco Chronicle reported Tuesday that a San Francisco trial judge refused to order the 21 grams of marijuana returned for fear of violating federal law. Possession of less than an ounce of marijuana is legal in California. Marijuana remains illegal under federal law.

A San Francisco superior court appellate panel says judges are protected from prosecution while handling illegal drugs while enforcing the law.

Police seized the marijuana while arresting Robert Smith in January. Charges were ultimately dismissed.

Smith’s attorney, University of San Francisco law professor Lara Bazelon, says the decision was an “important ruling in a seemingly small case.”