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

Receive the latest national-international updates in your inbox

This Nov. 18, 2014, file photo shows the U.S. Supreme Court in Washington, as seen from the roof of the U.S. Capitol. In a far-reaching case that probes the limits of free speech over the Internet, the Supreme Court on Monday is considering whether a man's threatening Facebook posts, and others like it, deserve protection under the First Amendment.

From the violent lyrics of rap music to the crude comments of teenagers in video-game chat rooms, 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 posting violent threats on Facebook — in the form of rap lyrics — about killing his estranged wife, shooting up a school and slitting the throat of an FBI agent.

Lawyers for Anthony Elonis say he didn't mean to threaten anyone. They contend his posts 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 proper test is not what Elonis intended, but whether his words would make a reasonable person feel threatened. That's the standard a jury used in convicting him under a federal law barring threats of violence.

Some 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?" asked 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 records, cell phone records and other evidence of context. He said many speakers being prosecuted "are teenagers who are essentially shooting off their mouths and making sort of ill-timed, sarcastic comments which wind up getting them thrown in jail."

As a recent example, he cited a teenager prosecuted for making sarcastic comments in a video-game chat room about shooting up a kindergarten after another teen called him crazy.

Chief Justice John Roberts suggested the government's standard simply would be whether a reasonable person familiar with teenagers in video-game chat rooms would view it as a threat. But Elwood said everyone has a different view of context and the better standard is looking at what the speaker intended.

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."

The Supreme Court has said "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."

Justice Elena Kagan asked whether there should be a "buffer zone" under the First Amendment "to ensure that even stuff that is wrongful maybe is permitted because we don't want to chill innocent behavior."

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

"You know, 'Da-da make a nice bed for mommy at the bottom of the lake,'" Roberts said, quoting an Eminem song.

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.

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

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."

Elonis' wife testified that the comments made her fear for her life and obtain a protective order. After the court proceedings, Elonis wrote a lengthy post wondering whether the protective order was thick enough to stop a bullet.

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

A female FBI agent later visited Elonis at home to ask him about the postings, and afterward 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 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.

Elwood argued that Elonis had a disclaimer on his Facebook page that his comments were only for entertainment. But Justice Samuel Alito asked if Congress really intended the law "to turn on this inquiry into a really strange psychological state."

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

Domestic violence advocacy groups argue that requiring proof that a speaker intended to be threatening would undermine the law's protective purpose.