BOSTON -- The state's highest court Tuesday said that raising a middle finger has a long and colorful history as an insult and is protected by the right to free speech, but when the gesture comes with more troubling behavior, it can possibly be a real threat in limited cases.

The state Supreme Judicial Court ruled in the case of a Northampton man, Robert J. O'Brien, about 38, who had given the middle finger to an off-duty Northampton police officer, Sgt. Alan Borowski, on three separate occasions in 2010, once on a street outside a city bar and twice when he was driving by the officer's home.

A Northampton District Court judge had granted Borowski a civil order that said O'Brien could not abuse or harass Borowski. O'Brien appealed, contending the middle finger was protected speech under the U.S. Constitution.

The court granted O'Brien's request to dismiss the anti-harassment order, but not on constitutional grounds. The court said the order had expired after a year and the case was moot.

The court did not rule on whether the state's recent law to crack down on harassment was properly applied in O'Brien's specific case. The court said it needed more information from the lower court about the alleged acts of harassment, but the case was moot in any event.

Still, the court warned in general about the possible ramifications of throwing someone a middle finger.

“We recognize that the raising of the middle finger as a form of insult has a long, if not illustrious, history dating back to ancient Greece,” said the high court’s decision, written by Judge Ralph D. Gants. “Like its verbal counterpart, when it is used to express contempt, anger, or protest, it is a form of expression protected by the First Amendment.”

“But, in certain limited circumstances, when accompanied by other less expressive and more threatening conduct, raising the middle finger may constitute fighting words or a true threat,” the court wrote.

In a footnote, the court noted the gesture's history in this country dates back to at least 1886, when its first recorded appearance "occurred in a professional baseball team photograph, where a pitcher for the Boston Beaneaters gave the middle finger while posing for a joint team picture with the New York Giants."

The court ruled that a state anti-harassment law is constitutional.

In court papers, O'Brien had said that the state harassment-prevention law is unconstitutional because it is too broad in that it might regulate free speech. He said the law was unconstitutional as applied to him because the use of the middle finger was protected speech.

Borowski had argued that O'Brien's raising of his middle finger reflected a threat of physical harm when the gesture was viewed in the context of the incidents and therefore is not protected by the constitution, according to the decision.

Borowski obtained the harassment-prevention order under a 2010 law to allow individuals to obtain civil restraining orders against people who are not family or household members, and to make the violation of those orders punishable as a crime.

The law allows the issuing of a harassment-prevention order against an individual given three or more instances of harassing conduct that intends and then does cause fear, intimidation, abuse or property damage

In the decision, the high court said that so-called civil harassment law is not unconstitutionally over broad. The court said the law does not ban a substantial amount of protected speech, “either in an absolute sense or in relation to the statute’s legitimate sweep.”

The high court said most speech is protected from government regulation under the first amendment of the U.S. Constitution. However, “fighting words” and “true threats” are among well-defined and limited classes of speech that are not protected, because they are outweighed by the dangers they pose, the court said.

The state law’s requirement that the pattern of harassment in fact cause fear, intimidation, abuse, or damage to property satisfies the "true threat" requirement that the threat be regarded as a serious expression of intent and not mere hyperbole, the court said.

Borowski testified that he knew O'Brien for years and that he knew he was a fighter and he felt threatened by him. In support of the harassment-prevention order, the sergeant said he was afraid to see O’Brien in public because of his prior dealings with him as a police officer, according to court records. The officer had previously charged O'Brien with a crime in 2006.

Under the law, the police sergeant had to prove at least three willful and malicious acts of harassment directed at him, each committed with the intent to cause intimidation, abuse, damage to property, or fear of physical injury or property damage.

But the district court judge did not make any factual findings on each of the three alleged acts of harassment, and the evidence is not so strong to allow the high court to infer findings, the court said. It makes no sense to send the case back to the lower court because the order expired, making the case moot, the court said.

“Because we cannot affirm the order of harassment without further findings, and because the case is now moot, the order of harassment must be vacated,” the court said.

According to the decision, Borowski said the first incident occurred when Borowski and his girlfriend went to a Northampton bar on May 15, 2010. Borowski quickly left when he spotted O'Brien. However, O'Brien followed Borowski and his companion out into the street, shouted his name, yelled an obscenity and raised both middle fingers, according to court records.

On Aug. 8 of 2010, O'Brien was a passenger in a vehicle that drove past Borowski 's home while Borowski was moving his truck. O’Brien leaned out a window and flipped off Borowski with the middle finger. A few hours later, O’Brien again made the gesture while he was a passenger in a vehicle that passed the home of Borowski, who was standing on his deck.

.