WASHINGTON — Anthony Elonis went to prison after writing Facebook messages suggesting he might kill his wife. Now his case is before the U.S. Supreme Court, which will consider for the first time how free-speech rights apply on social media.

Elonis, who cites singer Eminem as an inspiration, says his messages were rap lyrics that weren’t intended as threats and deserve protection as speech. Among his posts: “I’m not gonna rest until your body is a mess.” Another envisioned his wife’s “head on a stick.”

The court on Dec. 1 will consider overturning Elonis’ conviction for threatening his wife, local schoolchildren and an FBI agent. At stake, he says, is how much freedom users of social media have to express themselves.

“It would be very chilling on communications” if the verdict against Elonis is upheld, said John Elwood, his lawyer. “It would sweep in too much protected speech, and it’s just too lax a basis to go to jail.”

The dispute pits free-speech defenders worried about the criminalization of online communications against advocates for crime victims who fear the court could erect barriers to prosecuting stalkers.

“This case is just about threatening speech,” lawyers for the National Network to End Domestic Violence wrote in court papers. “Advances in technology give perpetrators of intimate partner violence an ever-increasing array of tools to threaten their victims.”

The case stems from Facebook posts Elonis made after his wife left him in 2010 with their two children and he was fired from his job at Dorney Park and Wildwater Kingdom, an amusement park in Pennsylvania.

Elonis’s wife obtained a restraining order, saying she had seen the Facebook posts and found them threatening. He responded by writing that she should fold up the protection order and “put it in your pocket/ Is it thick enough to stop a bullet?”

Elonis, who’s now 31, wrote under the hip-hop pseudonym “Tone Dougie” – a play on his first and middle names. He claims his posts were a form of rap lyrics inspired by musicians like Eminem, whose songs include references to violent acts against his mother and ex-wife. Elonis included disclaimers that he was writing lyrics as an “aspiring rapper” and included links to news stories about First Amendment cases.

Elonis argued at trial that the government had to prove that he intended to communicate a true threat. The judge instead instructed the jury that the standard is how a reasonable person would interpret the remarks. Elonis was convicted on four of five counts and sentenced to 44 months in prison.

Requiring prosecutors to prove that a defendant intended to threaten someone would create insurmountable burdens for victims and prosecutors, said Rebecca Roe, a lawyer who wrote a brief for the National Center for Victims of Crime.

That’s particularly true in cases of domestic violence because threats tend to be more oblique than what Elonis wrote on Facebook, Roe said in an interview.

Some free-speech advocates support Elonis. Upholding his conviction would restrict expression because much of what is written online is open to multiple interpretations, according to the American Civil Liberties Union.