SAN FRANCISCO (AP) — California can’t enforce a ban vanity license plates it considers “offensive to good taste and decency” because that violates freedom of speech, a federal judge ruled Tuesday.

U.S. District Judge Jon Tigar ruled in a case filed in March against Department of Motor Vehicles Director Steve Gordon on behalf of five Californians who were denied permission to put their messages on personalized license plates.

READ MORE: Long Lines Form Outside San Mateo Event Center COVID-19 Vaccination Site

They included a gay man in Oakland who owns Queer Folks Records and wanted to use the word “QUEER” but was refused because the DMV said that might be considered insulting; a fan of the rock band Slayer who was notified that “SLAAYRR” would be considered “threatening, aggressive or hostile” and an Army veteran who wanted to note his nickname and love of wolves with “OGWOOLF” but was refused because the DMV said the OG might be construed as a reference to “original gangster.”

Others were refused because their plates might look or sound like a swear word or might be construed as sexual, according to the judge’s ruling.

Citing U.S. Supreme Court free-speech cases, the judge struck down a DMV standard that said vanity license plate configurations can’t carry “connotations offensive to good taste and decency.”

READ MORE: Late Rally Fizzles, Warriors Fall to Spurs 112-107

The judge said the personalized messages were types of personal expression, not “government speech,” and therefore regulations governing them “must be both viewpoint-neutral and reasonable.”

He noted a 2017 U.S. Supreme Court case allowing an Asian American rock band to call itself The Slants in saying that public speech can’t be barred because it may offend some people.

However, Tigar said the DMV probably could be permitted to deny plates that are, for instance, obscene, profane or contain hate speech because they fall outside of First Amendment protections.

“This is a great day for our clients and the 250,000 Californians that seek to express their messages on personalized license plates each year,” attorney Wen Fa of the Pacific Legal Foundation, which filed the lawsuit, said in a statement. “Vague bans on offensive speech allow bureaucrats to inject their subjective preferences and undermine the rule of law.”

MORE NEWS: King Tide Flooding on SF Waterfront Foreshadows Future Climate Change Norm

The DMV was reviewing the ruling and declined further comment, the San Francisco Chronicle reported.