The Minnesota Supreme Court on Wednesday reversed the cyberbullying conviction of a Scott County high school student, ruling that the state laws under which he was charged are overly broad and impede free speech.

Because the court ruled the laws unconstitutional, the court didn’t determine whether the defendant’s “unrelenting torrent of cruel tweets” directed at a classmate was protected speech under the First Amendment.

The underpinning of the decision, written by Justice Paul Thissen, is that the state’s laws on mail harassment and stalking by mail are written so broadly that they impinge on free speech protected by the U.S. Constitution. The ruling reversed multiple convictions for the juvenile, identified only as A.J.B.

“Obviously, we consider this a pretty big victory three years in the making,” said John Arechigo, the defendant’s attorney. “It’s certainly a win for freedom of speech.”

However, Thissen’s 41-page ruling states that the mail-harassment law could be narrowly interpreted to allow for prosecution. The high court returned the case to Scott County District Court to determine whether A.J.B. intended to “abuse” the target of the tweets, which would be the sole remaining possibility under which he could be convicted.

The Supreme Court was addressing A.J.B.’s appeal of his Scott County conviction stemming from online activity in March 2016, when the defendant and his friends saw a series of tweets by a male student — identified as M.B. — that referred to girls at their school.

In response, A.J.B. created an anonymous Twitter account. Within three hours, A.J.B. had posted some 40 tweets about M.B., specifically mentioning him by his Twitter handle, the high court said.

“Essentially all of the tweets posted by A.J.B. ... contained cruel and egregious insults,” the court said. Insults included a checkerboard of M.B.’s image with a caption reading, “Click the Autistic Child.”

Other tweets encouraged M.B. to try a new cologne called “Anthrax,” and to kill himself by drinking bleach. The tweets included homophobic slurs and called for the death penalty for gay people. A.J.B. didn’t send any direct messages to M.B., but mentioned him to ensure he would receive notification of them, the ruling said.

After a trial in juvenile court, A.J.B. was found guilty beyond a reasonable doubt of multiple charges of stalking and harassment by mail. A.J.B. appealed on First Amendment grounds, but the state Court of Appeals allowed the convictions to stand.

Thissen’s analysis states that there’s a point “where First Amendment protections end and government regulation of speech or expressive conduct becomes permissible.”

The limits fall generally into statements designed to “incite imminent lawless action,” obscenity, defamation, speech integral to criminal behavior called “fighting words,” child pornography, fraud and speech that presents “some grave and imminent threat” that government can prevent. Those principles, the court said, apply “with equal force” to the internet.

The court acknowledged the challenge of crafting a law that protects against bullying and harassment without infringing free speech rights, but said it’s possible.

In finding that the harassment laws curbed free speech, the state Supreme Court reversed A.J.B.’s convictions. The court noted that under federal law, stalking by mail requires that a person intend to “kill, injure, harass, intimidate or place under surveillance.” In contrast, the state high court cited Minnesota law that stalking by mail can occur “even when a person does not know — much less intend — that the communication will frighten, threaten, oppress, persecute or intimidate the victim.”

Arechigo said that a Scott County judge will review the case and decide whether to find A.J.B. guilty of the abuse claim.

Thissen wrote on behalf of Chief Justice Lorie Gildea and Justices G. Barry Anderson, Natalie Hudson and David Lillehaug. Justice Margaret Chutich wrote a concurring opinion that was also signed by Justice Anne McKeig.