WASHINGTON – Anthony Elonis went to prison after writing Facebook messages suggesting that 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 cited singer Eminem as an inspiration, said his messages were rap lyrics not 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 Monday will consider overturning Elonis' conviction for threatening his wife, schoolchildren and an FBI agent. At stake, he said, is how much freedom social media users 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 and he was fired from his job.

Before Halloween, he wrote that his son's costume should be "matricide" and include his wife's "head on a stick." He later posted on the site: "There's one way to love ya but a thousand ways to kill ya/ And I'm not gonna rest until your body is a mess."

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 is now 31, wrote under the hip-hop pseudonym "Tone Dougie" — a play on his first and middle names. He claimed 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.

After writing that there were enough elementary schools around "to initiate the most heinous school shooting ever imagined," two Federal Bureau of Investigation agents visited Elonis at home. He followed up with a Facebook post threatening one of them.

Elonis argued at trial that the government had to prove that he intended to communicate a true threat. The judge 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.