In a unanimous decision, the Supreme Court ruled today that a North Carolina law prohibiting sex offenders from using social media was unconstitutional.

The state has prosecuted more than 1,000 people under the law

“A fundamental principle of the First Amendment is that all persons have access to places where they can speak and listen, and then, after reflection, speak and listen once more,” Justice Kennedy writes in the court’s decision, adding that digital spaces — including Facebook and Twitter, which the ban applied to — are also protected.

The case before the court focused on a sex offender prosecuted after posting on Facebook about beating a traffic ticket. “Man God is Good!” he wrote. “How about I got so much favor they dismissed the ticket before court even started?” According to figures cited in the case, the state has prosecuted more than 1,000 people for violating the law.

“By prohibiting sex offenders from using those websites, North Carolina with one broad stroke bars access to what for many are the principal sources for knowing current events, checking ads for employment, speaking and listening in the modern public square, and otherwise exploring the vast realms of human thought and knowledge,” Kennedy writes.

Justice Alito, concurring, also writes that the North Carolina broad law seemed to violate First Amendment protections, although he added that there may still be other websites — such as sites focused on teen audiences — where a ban could be reasonable.

The case was closely watched by civil rights organizations anxious to see how the court would decide a case about First Amendment protections online. In December, the Electronic Frontier Foundation wrote that “digital liberties are fundamental human rights. All people should enjoy them.”