Supreme Court justices are weighing the First Amendment implications of a ban on sex offenders viewing President Donald Trump’s tweets – along with a broad swath of other political, religious and social content on websites that permit interactive profiles.

The president’s tempestuous and news-driving Twitter account was specifically mentioned by Justice Elena Kagan during oral arguments Monday in Packingham v. North Carolina, in which registered sex offender Lester Packingham challenges a state law that made him guilty of a felony for celebrating a traffic court win on Facebook.

“So a person in this situation, for example, cannot go onto the president's Twitter account to find out what the president is saying today?” Kagan asked.

"That's correct," responded Robert Montgomery, North Carolina's senior deputy attorney general, who argued there simply is no enforceable and less restrictive option to keep offenders from prowling for under-18 users of popular websites than to banish them completely.

“There's a constitutional right to use Snapchat, but not to use Twitter?” Kagan asked skeptically, pointing out the state law has carve-outs allowing sex offenders to access photo-sharing sites and chat rooms, which she said would seem more dangerous for minors.

Montgomery had said the state carved out such platforms because they allow for "pure forms of communication," and later said concern centered on anonymous information collection.

The case has attracted widespread interest, with various groups warning that a ruling upholding the North Carolina law could allow for bans on internet use for other groups convicted of crimes, such as people convicted of unlawfully protesting.

Justice Stephen Breyer, appearing to express concern about bans on internet access, said, “pretty soon, you're going to have everybody convicted of different things not being able to go anywhere and discuss anything.”

Justice Sonia Sotomayor said Facebook could also be used to perform research for bank robberies, adding that the law was being “applied indiscriminately” to a diverse group of offenders, including teenagers who had committed statutory rape.

Federal courts have struck down similar laws in California, Indiana, Louisiana and Nebraska. But the North Carolina Supreme Court in 2015 found "the statute is constitutional in all respects."

A dissent in the state court ruling warned that the law makes it a felony to access the website of The New York Times, which permits minors to create profiles and communicate via article comments.

Montgomery assured justices that sex offenders can legally view The Times' website, but justices weren't so sure, resisting his suggestion they adopt an unconventional reading of the words “such as” and assume the presence of an “implied colon.”

A North Carolina law bans registered sex offenders from accessing Twitter, and arguably from visiting the websites of major news outlets. (Twitter/Screenshot)

Addressing a central issue in the case, justices asked Montgomery to produce an example of a similar “prophylactic” ban on speech that was found constitutional.

Montgomery, who had noted court-permitted bans on felons owning guns and voting, pointed to a 1992 ruling in Burson v. Freeman that upheld a 100-foot buffer zone around voting locations to protect against fraud and intimidation.

“I don’t think that helps you at all here,” Justice Anthony Kennedy said, after Breyer asked skeptically for cases his clerks could surface for him.

“That’s like one out of a zillion First Amendment cases we’ve decided in our history,” Kagan said. "And, as Justice Kennedy says, there are many reasons to think it's distinguishable from this one."

Attorney David Goldberg, representing Packingham, meanwhile, was pressed by justices for a concise explanation of why the law was unconstitutional. He had offered many, as had groups submitting amicus briefs.

Goldberg prioritized claims the law was not narrowly tailored and was overbroad. He said a ban on communication with minors over social media might be constitutional, though he pointed out registered sex offenders are not all child predators.

At various points, justices grappled with challenges presented by the internet in protecting children from predators.