WASHINGTON >> The Supreme Court is weighing the free-speech rights of people who use violent or threatening language on Facebook and other social media.

The justices will hear arguments Monday in the case of a man who was sentenced to nearly four years in prison for posting graphically violent rap lyrics on Facebook about killing his estranged wife, shooting up a kindergarten class and attacking an FBI agent.

Anthony Elonis of Bethlehem, Pennsylvania, says he was just venting his anger over a broken marriage and never meant to threaten anyone.

But his wife didn’t see it that way, and neither did federal prosecutors. A jury convicted Elonis of violating a federal law that makes it a crime to threaten another person. A federal appeals court rejected his claim that his comments were protected by the First Amendment.

Lawyers for Elonis argue that the government must prove he actually intended his comments to threaten others. The government says it doesn’t matter what Elonis intended; the true test of a threat is whether his words make a reasonable person feel threatened.

One post about his wife said, “There’s one way to love you but a thousand ways to kill you. I’m not going to rest until your body is a mess, soaked in blood and dying from all the little cuts.”

The case has drawn widespread attention from free-speech advocates who say comments on Facebook, Twitter and other social media can be hasty, impulsive and easily misinterpreted. They point out that a message on Facebook intended for a small group could be taken out of context when viewed by a wider audience.

“A statute that proscribes speech without regard to the speaker’s intended meaning runs the risk of punishing protected First Amendment expression simply because it is crudely or zealously expressed,” said a brief from the American Civil Liberties Union and other groups.

So far, most lower courts have rejected that view, ruling that a “true threat” depends on how an objective person perceives the message.

For more than four decades, the Supreme Court has said that “true threats” to harm another person are not protected speech under the First Amendment. But the court has been careful to distinguish threats from protected speech such as “political hyperbole” or “unpleasantly sharp attacks.”

Elonis argues that his online posts under the pseudonym “Tone Dougie” were simply a crude and spontaneous form of expression that should not be considered threatening if he didn’t really mean it. His lawyers say the posts were heavily influenced by rap star Eminem, who has also fantasized in songs about killing his ex-wife.

But Elonis’ wife testified that the comments made her fear for her life.

After his wife obtained a protective order against him, Elonis wrote a lengthy post mocking court proceedings: “Did you know that it’s illegal for me to say I want to kill my wife?”

A female FBI agent later visited Elonis at home to ask him about the postings. Elonis took to Facebook again: “Little agent lady stood so close, took all the strength I had not to turn the bitch ghost. Pull my knife, flick my wrist and slit her throat.”

The Obama administration says requiring proof that a speaker intended to be threatening would undermine the law’s protective purpose. In its brief to the court, the Justice Department argues that no matter what someone believes about his comments, it doesn’t lessen the fear and anxiety they might cause for other people.