LOUISVILLE, Ky. (AP) — Kentucky went too far in restricting internet access for registered sex offenders, violating free-speech rights by clamping down on their use of social media, a federal judge ruled Friday.

In striking down the restrictions, U.S. District Judge Gregory Van Tatenhove said state law could keep sex offenders from participating in "basic online activities." As an example, he said it would restrict them from accessing a newspaper website because of its public comments section.

The judge wrote that one of the Kentucky laws under review "burdens substantially more speech than necessary to further the commonwealth's legitimate interests in protecting children from sexual abuse solicited via the internet."

His ruling concluded that registered sex offenders have a constitutional right to use Facebook, Twitter and other social media. He ruled in a lawsuit filed by a Lexington man who registered as a sex offender due to his conviction for possessing child pornography.

Scott White, an attorney representing the man, identified in the ruling as John Doe, called it an important case that "in no way puts children or vulnerable people at risk."

"Kentuckians who find themselves on the sex offender registry will now be able to more mainstream their lives, which helps in their rehabilitation, helps them find to find a job," he said.

The state Justice Cabinet said attorneys are reviewing the decision.

Van Tatenhove cited a U.S. Supreme Court ruling this year that struck down a similar North Carolina law barring convicted sex offenders from Facebook, Twitter and other popular sites.

Kentucky Attorney General Andy Beshear is hoping state lawmakers take up the issue next year. After the high court's ruling in the North Carolina case, he said, he presented draft legislation to lawmakers that he predicted could pass constitutional muster.

"Today, more than ever, we must work together to safeguard Kentucky's children from sexual predators when they visit social networking websites," Beshear said in a statement Friday.

In the Kentucky case, Van Tatenhove was asked to rule on two state laws. One prohibited sex offenders from using social networking websites or instant messaging or chat rooms that could be accessible to children. The other required sex offenders to update their probation or parole officers on all of their email addresses, instant messaging names and other online identities.

The Lexington man who sued claimed the law violated his free-speech rights.

The law's defenders argued that it applies only to websites that minors are truly likely to frequent and use for communications. Van Tatenhove said the statute "fails to make that clear."

"Rather than prohibiting a certain type of conduct that is narrowly tailored to prevent child abuse, the statute prevents Mr. Doe and others similarly situated from accessing 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," the judge wrote.

He also found flaws in the law requiring sex offenders to keep their probation and parole officers updated on all of their online identities.

"It may be true that the General Assembly meant the law to apply only to a sex offender's new Facebook profile, but the law as written might as well apply to usernames created to engage in online dialogue over Amazon.com products of Washingtonpost.com news stories," he wrote.