The U.S. Supreme Court on Monday struck down a North Carolina law that prohibited sex offenders from using Facebook, Twitter and other social media sites.

As Reuters reports, the law had been challenged by Lester Packingham, who is registered as a sex offender due to a statutory rape conviction. He was later convicted of violating the 2008 social media ban after he posted about beating a traffic ticket on Facebook.

The law was implemented to keep sex offenders away from websites that would allow them to engage in social interactions with children. Packingham argued that the law transgressed his right to free speech as guaranteed by the First Amendment. And the Supreme Court agreed, ruling 8-0 in Packingham’s favor.

“This case is one of the first this court has taken to address the relationship between the First Amendment and the modern Internet,” Justice Anthony Kennedy wrote in a majority opinion. “As a result, the court must exercise extreme caution before suggesting that the First Amendment provides scant protection for access to vast networks in that medium.”