Writing an obscene phrase on a speeding ticket payment form is speech protected by the First Amendment and shouldn’t send the person who wrote it to jail, a federal judge has ruled. The ruling represents an important victory for free speech rights, lawyers in the case said Tuesday.

A police officer in the New York town of Liberty issued the ticket to Connecticut resident William Barboza in June 2012. Barboza, then 22, later pleaded guilty and paid by mail, noting his frustration by scrawling the words “fuck your shitty town bitches” on the form. He also crossed out the word “Liberty” and wrote “Tyranny” instead. About four months later he was called back to the town’s court, where he was arrested, handcuffed and briefly jailed.

A municipal judge in 2013 dismissed charges against him, according to the New York Civil Liberties Union (NYCLU). He sued town officials, arguing his arrest was unconstitutional.

Last week, Judge Cathy Seibel in the U.S. Southern District Court of New York in White Plains ruled that his speech was protected by the constitution. A federal jury will now hear arguments in the lawsuit and decide whether Barboza should receive payment for damages.

“He got booked and cuffed and printed and he was there [in jail] for about two hours” before paying bail of around $200, said his attorney, Stephen Bergstein. “What’s scary is if he couldn’t pay bail he would have stayed in jail.”

In her decision, Seibel explained that the clerks who received Barboza’s marked-up form had been “upset and alarmed by it.” She said the local Liberty judge, Brian Rourke, “believed the phrase ... might be a threat to those women,” and passed the matter to Sullivan County Assistant District Attorney Robert Zangala — who is now a defendant in the case.

Without speaking to the clerks personally, Zangala and fellow attorneys decided on the aggravated harassment charge — although both Zangala and District Attorney James Farrell had also “discussed the fact that [Barboza] might have a First Amendment defense to the charge” but decided to arrest him anyway, Seibel said.

The court then called Barboza back to Liberty’s court on Oct. 18, 2012, and Zangala ordered court security to arrest him.

“Instead of protecting freedom of speech, government officers in Liberty handcuffed me, arrested me for a crime and almost sent me to jail because I harmlessly expressed my frustration with a speeding ticket,” Barboza said in a statement provided by the NYCLU, which served as co-counsel on the case in the lawsuit.

“The people I trusted to uphold the law violated my most basic rights,” he said.

His lawyer, Bergstein, said District Attorney Zangala and his office had misinterpreted the meaning of the aggravated harassment statute. Barboza’s speech was fundamentally political and did not constitute a threat or other abuse of free speech rights, Bergstein said.

“It’s just offensive. It doesn’t hurt anybody,” Bergstein told Al Jazeera. “It doesn’t impair the function of government and it doesn’t make anybody have to call the police.”

Judge Seibel criticized Liberty’s police department for failing to train its officers on free speech rights. The jury hearing the case will decide whether the department’s officers require retraining.

“Neither the Village of Liberty Police Department general rules of conduct nor the Liberty Police Department rules and regulations and manual of procedure contain guidelines about arresting people ... for abusive expression,” Seibel said.

“The village has no requirement to insure its officers are trained on the First Amendment. The village seemed to rely in this respect on the Police Academy training that officers are required to obtain before being hired, but takes no steps to freshen its officers' understanding as the law develops,” she added.

Liberty’s Mayor Ron Stabak declined to speak about the matter, citing the ongoing lawsuit. The town’s police chief and Zangala did not return requests for comment.

Marlin Randall, a law professor specializing in free speech at Carleton University in Ottawa, hailed the judge’s decision. He said the power police have can slip toward the “tyrannical” if they don’t keep citizens’ rights in mind.

“Police have to suck it up,” Randall said. “And by which I mean not react in a punitive way, given the massive amount of power that police have over the ordinary citizen.”