The Supreme Court struggled Monday over where to draw the line between free speech and illegal threats in the digital age.

The justices considered the case of a Pennsylvania man convicted of making violent threats after he posted Facebook rants about killing his estranged wife, harming law enforcement officials and shooting up a school.

Lawyers for Anthony Elonis say he didn't mean to threaten anyone. They contend his posts in the form of rap lyrics under the pseudonym "Tone Dougie" were simply a way for him to vent his frustration over splitting up with his wife.

The government argues the real test is whether his words would make a reasonable person feel threatened. In one post about his wife, Elonis 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."

Several justices seemed concerned that the government's position is too broad and risks sweeping  in language protected by the First Amendment. But there seemed to be little agreement over what standard to use.

"How does one prove what's in somebody else's mind," said Justice Ruth Bader Ginsburg, who was on the bench five days after she had a stent implanted to clear a blocked artery.

Elonis attorney John Elwood said the speaker's intent could be determined by searching computer and cell phone records. He suggested under the government's view, someone posting a picture of violence following the police shooting of an unarmed man in Ferguson, Missouri, might be prosecuted for mentioning Thomas Jefferson's words about the "blood of tyrants."

Justice Antonin Scalia questioned whether Elonis's comments about causing physical harm in the context of a marital dispute deserve First Amendment protection. He said the government's standard "doesn't eliminate a whole lot of speech at all."

Chief Justice John Roberts wondered about rap stars like Eminem, who has used graphic language about killing his ex-wife that may be misinterpreted as a threat.

"How do you start out if you want to be a rap artist?" Roberts asked.

Justice Department attorney Michael Dreeben, representing the government, said a jury can look at the context in which comments are made. Eminem's lyrics are sung at a concert where people go to be entertained, he said.

Elonis' wife testified that the comments made her fear for her life and obtained a protective order against him. After the court proceedings, Elonis wrote a lengthy post wondering if the protective order would stop a bullet.

"He ramps up and escalates the threat of the statements," Dreeben said.

Elwood argued that Elonis had a disclaimer on his Facebook page that his comments were only for entertainment purposes. But Justice Samuel Alito seemed skeptical.

"This sounds like a roadmap for threatening a spouse and getting away with it," Alito said.

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.

The Obama administration says requiring proof that a speaker intended to be threatening would undermine the law's protective purpose.