When Willian Barboza received a speeding ticket a few years ago in upstate New York, he decided to send back a not-so-nice message. 

"F--- your s----y town b----es," Barboza wrote when he sent back the $175 payment to the town of Liberty, N.Y.

At the top of the page, he even crossed out Liberty, and wrote in "Tyranny."

After that, Barboza, then 22 years old, was ordered to appear in court and a judge ordered him arrested. He was then released on $200 bail. 

Female clerks in the municipal office had apparently become upset by the profanity and felt it was threatening. 

Now, a federal judge has ruled in Barboza's favor after he filed a lawsuit, ruling that his arrest was unconstitutional and a violation of his First Amendment rights.

Barboza, who was represented at trial by the New York Civil Liberties Unions, had sought unspecified damages. 

U.S. District Judge Cathy Seibel wrote that the town had many other cases in which officers arrested people for speech that was deemed threatening. 

FoxNews.com reported:

In an NYCLU release, Barboza was quoted as saying he was treated as a criminal for a "few harmless words."

"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," he said.

Barboza's case is not unique in Liberty. Seibel said that between 2003 and 2012 as many as 63 arrests by police officers in the village had occurred "because of the use of vulgar words in what may be perceived as a threatening context." She said one arrest occurred when a defendant called someone a slut, another resulted from someone talking about sexual acts on a police department phone line and another came after a defendant threatened to kill someone's dog.

Judge Andrew Napolitano reacted to the ruling on "Shepard Smith Reporting," saying that Barboza's "political comment" about the incident is protected.

Napolitano said the prosecutor who ordered Barboza to be arrested should have known that this speech is protected.

He explained that he does not recommend anyone "get in the face of a police officer," but people should know that they can legally criticize a police officer. 

Napolitano said even if someone curses at a police officer during his or her arrest, they can't be charged for it unless they make a threat. 

Overall, he called the ruling a great and rare victory for the First Amendment.