The U.S. Supreme Court has overturned the conviction of a man who has been imprisoned for posting violent rants on Facebook which were directed against his ex-wife. The high court, under Chief Justice John Roberts, voted in favor of the reversal by an 8-1 margin on Monday, according to the Los Angeles Times.

Anthony Elonis from Pennsylvania posted a series of rants addressed to his former wife by citing lyrics from hip-hop songs. According to his defense, these posts were covered by the First Amendment and that they were hardly "true threats." He perceived the rant as "therapeutic."

Friends alerted the authorities of Elonis' posts and the FBI went to investigate the defendant at his house. He also posted a Facebook message directed against an FBI agent, saying that he was going to "pull my knife [and] slit her throat," the LA Times reported.

A jury convicted Elonis to three years and eight months of prison time, but his lawyers appealed the case to the Supreme Court. This time, the court sided with the defendant, citing that it based its decision on the history of criminal law.

"Federal criminal liability generally does not turn solely on the results of an act without considering the defendant's mental state. That understanding 'took deep and early root in American soil' and Congress left it intact here," Roberts said in the decision.

Roberts also said that the jury convicted Elonis without any proof that he had awareness his rants were true threats. The chief justice further reiterated that the defendant can only be convicted if he "transmits a communication for the purpose of issuing a threat, or with knowledge that the communication will be viewed as a threat."

Anti-domestic violence groups have condemned the decision, saying that it will now be harder to punish people who make threats on social media.

"Threats cause devastating harm to victims, including fear, anxiety, loss of sleep, and disruption, regardless of whether the abuser intended to threaten or only intended to vent or to make a joke," said Kim Gandy of the National Network to End Domestic Violence, according to NBC News.

Civil liberty groups, however, applauded the decision, saying that "proving criminal intent before putting someone in jail" has been the law for centuries.

Meanwhile, Elonis' legal battle is far from over as he is still facing charges for domestic violence against the mother of his girlfriend, NBC reported.