— The Supreme Court struck down a North Carolina law Monday that bars convicted sex offenders from Facebook, Twitter and other popular sites.

The justices ruled unanimously in favor of North Carolina resident Lester Packingham Jr. His Facebook boast about beating a traffic ticket led to his conviction for violating a 2008 law aimed at keeping sex offenders off internet sites children might use.

The court rejected the state's argument that the law deals with the virtual world in the same way that states keep sex offenders out of playgrounds and other places children visit.

"In sum, to foreclose access to social media altogether is to prevent the user from engaging in the legitimate exercise of First Amendment rights," Justice Anthony Kennedy wrote in his majority opinion.

Chief Justice John Roberts and Justices Samuel Alito and Clarence Thomas cautioned that Kennedy's "loose rhetoric" could prevent states from taking any measures to restrict convicted sex offenders on the internet. "This language is bound to be interpreted by some to mean that the states are largely powerless to restrict even the most dangerous sexual predators from visiting any internet sires, including for example internet dating sites," Alito wrote for the three justices.

Monika Johnson-Hostler, who runs the North Carolina Coalition Against Sexual Assault calls the law ineffective.

"Sex offender laws and bans have not shown a direct correlation to reduction," she said.

Johnson-Hostler said a better route to addressing sex assault crimes is to focus on treatment, rather than restrictions.

"The majority of those predators we’re worried about are not on a registry they’ve never been convicted and so the questions for us begin around how do we actually address social media in a adequate conscientious way in our general public," she said.

Louisiana is the only other state with a law similar to North Carolina's, although the Louisiana law applies only to people convicted of sex crimes with children, according to a legal brief the state filed with the Supreme Court. But many states have laws that require sex offenders to provide information about their internet use to authorities. Separately, many states limit internet use as a condition of parole or probation.

Packingham originally pleaded guilty in 2002 to taking indecent liberties with a child. He had been indicted for the statutory rape of a 13-year-old and ordered to register as a sex offender.

In 2010, a Durham police officer was using his own Facebook account to look for people who shouldn't be on the site. He came across a post from Packingham, who used an alias but also included a photo of himself and linked to an account used by his father and namesake. The officer found six other registered sex offenders in the same session, a lawyer for North Carolina told the justices when the case was argued in February.

"No fine. No Court costs. No nothing. Praise be to God. Wow. Thanks, Jesus," Packingham wrote in the post that led to his conviction and suspended prison sentence.