In a closely watched case testing the limits of free speech, the U.S. Supreme Court on Monday overturned the Philadelphia federal court conviction in 2011 of an Allentown-area man for threatening on his Facebook page to kill his estranged wife and an FBI agent.

The case has drawn national attention, in part because of its potential to define how the government can prosecute violent statements made on social media and on the Internet.

Writing for the majority, Chief Justice John G. Roberts Jr. said prosecutors must show that defendants knowingly intended in their threatening statements to issue a real threat in order to secure a conviction. Before Monday's ruling, the standard for such a conviction in several federal jurisdictions, including Pennsylvania, New Jersey and Delaware, had been only that the target of a violent communication feel threatened.

The defendant in this case, Anthony Elonis, 31, said during his trial that he never intended for his Facebook posts to be threatening and that his writings were a form of therapy for his depression. He used the persona Tone Dougie on social media and wrote long Facebook postings in the form of rap lyrics.

"Elonis' conviction cannot stand," Roberts wrote for the majority in the 8-1 decision. "The jury was instructed that the government need prove only that a reasonable person would regard Elonis' communications as a threat, and that was an error."

The U.S. Attorney's Office in Philadelphia, which prosecuted Elonis, said it was leaning toward seeking another trial.

The Supreme Court declined to directly invoke constitutional speech protections under the First Amendment, and instead focused on the legal principle that people convicted of crimes must know in general that what they were doing was wrong, the so-called mens rea doctrine.

But Ron Levine, a white-collar defense lawyer at Center City's Post & Schell who, with his colleague Abe Rein, represented Elonis in the appeal to the high court, said the holding likely would cause prosecutors to tread more delicately in pursuing cases that involve threatening speech.

"We are of course happy for our client and presume there will be a conversation with the government about next steps," Levine said. "Generally, when you want to prove someone guilty of a crime you have to prove their state of mind. You are not able to say it doesn't matter what the defendant thought."

Kermit Roosevelt, a constitutional law professor at the University of Pennsylvania law school, said that because the court declined to explore constitutional issues in its opinion, it would have no effect on state laws around the country that make it a crime to harass or bully people on the Internet.

Roosevelt and Robert Reinstein, constitutional law professor at Temple University law school, said the opinion could create confusion because it fails to address whether use of a recklessness standard, a bar that is short of intent but tougher than the law used in the Elonis trial, could apply.

Dozens of groups had sought to weigh in with friend-of-the-court briefs in this case. They ranged from the Anti-Defamation League, urging the high court to uphold the conviction, arguing that Internet bullying would otherwise spread, to People for the Ethical Treatment of Animals, worrying that its confrontational style of politics might be more easily prosecuted if the conviction were upheld.

The case stems from the Oct. 20, 2011, federal court conviction of Elonis, a former operations manager at Dorney Park & Wildwater Kingdom amusement park near Allentown, for violating a federal law that makes it a crime to transmit by interstate commerce "any communication containing any threat . . . to injure the person of another." He was convicted in U.S. District Court in Philadelphia on four of five counts for violating the federal threat statute and sentenced to three years and eight months in federal prison.

Elonis' threatening Facebook postings began after his wife of seven years, Tara, left him in the spring of 2010, taking their two young children with her. During his trial in 2011, his estranged wife testified she felt stalked, threatened, and afraid for her and her children's lives because of her husband's social media threats.

The jury also heard testimony that Elonis had been spotted crying uncontrollably at work, his head down on his desk, and then was sent home by supervisors.

On Oct. 17, 2010, the 28-year-old Elonis posted a picture on Facebook. It showed Elonis and a woman, a fellow worker at Dorney Park who had made sexual harassment complaints against him, dressed in costumes the staff used for the park's annual Halloween program. In the picture, Elonis held a fake knife to the woman's throat. The picture was originally intended as promotional material for the park, but on Facebook Elonis added the caption "I wish."

He was fired a short time later.

Thus began a period of increasingly hostile and agitated postings, which Elonis occasionally described as artistic musings, and which from time to time were accompanied by disclaimers that his words were not to be taken seriously. In one posting, allegedly regarding his wife, he said he wanted her "soaked in blood and dying from all the little cuts."

The FBI began to monitor his Facebook page, and after a post that seemed to suggest Elonis was contemplating a shooting attack on a local elementary school, two agents visited him at his parents' home outside Bethlehem, where he was staying. Later that day, he posted rap lyrics in which he allegedly threatened to kill FBI Agent Denise Stevens.

Elonis was released from federal prison in February 2014, and then was jailed in Northampton County in April of this year on domestic assault charges. He was accused of hitting his girlfriend's mother with a pot.

cmondics@phillynews.com

215-854-5957@cmondics