WASHINGTON (Reuters) - The U.S. Supreme Court on Friday took up a case testing free speech rights in the digital age, agreeing to decide whether a North Carolina law banning convicted sex offenders from Facebook and other social media sites runs afoul of the Constitution.

An illustration picture shows the Twitter logo reflected in the eye of a woman in Berlin, November 7, 2013. REUTERS/Fabrizio Bensch/Illustration/File Photo

The justices agreed to hear sex offender Lester Packingham’s appeal of his conviction for violating the state law in 2010 when he posted a message on Facebook expressing his surprise at a traffic citation being dismissed.

“Praise be to GOD. WOW! Thanks JESUS,” Packingham wrote.

Local police saw the Facebook post, prompting his arrest. Packingham is on North Carolina’s sex offender list because of his 2002 conviction at age 21 on two counts of statutory rape of a 13-year-old girl.

The North Carolina law, enacted in 2008, makes it a felony for people on the state’s sex offender registry to access websites that can lead to social interactions with minors.

The ban extends to sites like Facebook and Twitter that allow people to create personal profiles. The law does not require any proof that the user intended to use the site for an illegal purpose.

Packingham was sentenced to six to eight months in prison, suspended for a year.

An intermediate appeals court threw out the conviction, saying it violated the U.S. Constitution’s First Amendment guarantee of free speech. The state Supreme Court reversed that decision last November, ruling in part that Packingham’s free speech rights were not unduly burdened because there are ample other websites he could access.

A group of First Amendment lawyers had urged the U.S. Supreme Court to take up Packingham’s appeal. They said social networking sites have become indispensable places for speech about family life, politics and religion, and that the North Carolina law bars access to some of the most important venues for online speech.

The court is set to hear oral arguments and issue a ruling by the end of June.

The case is not the first the high court has taken up on social media and free speech.

In another case involving Facebook, the justices in 2015 threw out the conviction of a Pennsylvania man for making threatening statements using menacing language toward his estranged wife and others on the social media site.