SACRAMENTO, Calif. (CN) – For nearly a century, California has barred gun retailers from using handguns as advertising props in their store windows and parking lots in the name of public safety. The state claimed logos depicting revolvers could push suicidal passersby into impulsive purchases.

But on Tuesday, a federal judge opened the door for gun dealers to freely use the props, striking the 95-year-old law on First Amendment grounds.

“California may not accomplish its goals by violating the First Amendment,” U.S. District Judge Troy Nunley ruled in a 150-page order.

Nunley’s ruling is the latest in a four-year lawsuit brought by California gun dealers who were fined by the state for violating the handgun advertising ban.

The plaintiffs, led by Tracy Rifle and Pistol LLC, accused the California Department of Justice of infringing their free-speech rights. Under the law, the retailers could use huge neon storefront ads that said “GUNS GUNS GUNS” but not depictions of handguns.

Nunley, appointed by President Barack Obama in 2013, trashed the state’s argument that the advertising ban prevents suicides and minimizes gun violence. He said its expert witnesses couldn’t show that “impulsive handgun purchases result in impulsive handgun suicides” and noted that the state already has other firearm safeguards, such as a 10-day waiting period.

“The [state] has restricted disfavored speech without acknowledging the efficacy of policy choices that do not burden speech,” Nunley said. “The state has an array of policies at its disposal to combat handgun suicide and crime.”

The dealers sued in Sacramento federal court in 2014, challenging California Penal Code section 26820. Nunley denied the plaintiffs’ motion for preliminary injunction in 2015, with the Ninth Circuit affirming in 2016.

The plaintiffs’ attorneys included UCLA distinguished professor of Law Eugene Volokh, who has written First Amendment legal textbooks and runs the popular website The Volokh Conspiracy.

“Under the First Amendment, the government may not restrict speech on the theory that it will supposedly lead a few listeners to do bad things, or even to commit crimes,” Volokh said in a statement. “It’s good to see the district court recognizing that the First Amendment has no gun advertising exception.”

California Department of Justice spokeswoman Jennifer Molina said the department is still reviewing the decision.

The victorious plaintiffs said they expect California Attorney General Xavier Becerra to appeal.