Facebook logo Lionel Bonaventure/Getty

The United States Supreme Court ruled Monday that a North Carolina law prohibiting registered sex offenders from using any social networking site minors may also use is unconstitutional. The ruling stems from the 2010 conviction of Lester Packingham Jr., a registered sex offender, who had a Facebook account under an alias.

Packingham, a sex offender, was convicted for using Facebook to write “Man God is Good!” in a post of celebration following the dismissal of a traffic ticket, court documents show. A police officer found the post, and Packingham was charged with violating the law and given a suspended prison sentence. His motion to dismiss the indictment due to a violation of his First Amendment rights was denied. Although the state never even alleged he used the social networking site to contact a minor, court documents show.

Read: Can Police Track Your Phone Without Warrant? Supreme Court To Decide On Location Data

The law defines a commercial social networking site as a site that makes money from membership fees or ads, facilitates the introduction of two or more people, lets users make profiles or web pages that contain personal information like names or photos and provides users a means to communicate with one another. Violation of the law is a Class 1 felony in North Carolina.

The court decided the North Carolina law was unconstitutional with a unanimous 8-0 decision Monday. Justice Neil Gorsuch was not involved in the decision. The decision came in part due to the fact the law is so broad, it could be stretched to include sites that aren’t even considered social networking sites. Sites with commenting sections for instance like Amazon.com or the website of a news service could potentially fit the requirements of the law, meaning if a registered sex offender used one, it would classify as a violation of the law. The decision from the court did, however, say future laws of this nature could be constitutional, and not a violation of the First Amendment if those laws were more specific and barred communication with a minor that would come before a sexual crime.

Read: Same-Sex Marriage In North Carolina: Supreme Court LGBT Ruling Challenged With Republican Bill

“It is well established that, as a general rule, the government ‘may not suppress lawful speech as the means to suppress unlawful speech.’ ... That is what North Carolina has done here. Its law must be held invalid. The judgment of the North Carolina Supreme Court is reversed, and the case is remanded for further proceedings not inconsistent with this opinion,” said the ruling from the court read by Justice Anthony Kennedy.

Other states, like Louisiana and Kentucky, have similar laws in place that prohibit the use of social networking sites in some way by registered sex offenders.