The state passed a law in 2008 that was aimed at keeping predators from trolling the Internet for new victims. But that law "broadly prohibits substantial protected speech rather than specifically targeting the evil of improper communications to minors," a three-judge panel of the 7th U.S. Circuit Court of Appeals concluded.

State courts can impose limits on social media as a condition of a sex offender's probation or parole, but a "blanket ban" on Internet use violates the First Amendment's guarantee of free expression, the judges found.

A district judge in Indianapolis had upheld the law in June, but federal courts in at least two other states -- Nebraska and Louisiana -- struck down similar state laws in 2012.

The Indiana chapter of the American Civil Liberties Union challenged the statute on behalf of an offender identified only as "John Doe," who had served 21 months in prison for child exploitation. "Doe" was released in 2003 and isn't on parole or probation, but was covered by the state ban.

Ken Falk, the group's legal director, said Indiana already has laws on the books barring the solicitiation of children, with enhanced penalties for inappropriate communications online. The law overturned Wednesday barred the "completely innocent" use of social media, he said.

"If you wanted to participate in a chat room to work around a candidate, you can't do that," he said. "If you want to follow the pope on Twitter, you can't do that."

News websites increasingly require commenters to log in via a social network, and Falk said "Doe" couldn't supervise his own child's use of social media under the law.

Indiana Attorney General Greg Zoeller said his office has not decided whether to appeal the ruling.

"The Indiana Legislature made a policy decision in 2008 that the state's reasonable interests in protecting children from predators outweighed the interest of allowing convicted sex offenders to troll social media for information," Zoeller said in a statement issued by his office. "We have worked with county sheriffs and prosecutors in our defense of the legal challenges to these protections of our children, and we will need to review this 7th Circuit ruling to determine the state's next steps."

Facebook, the largest social media platform, already bars sex offenders from using the site under its Statement of Rights and Responsibilities states. It also prohibits children under 13 and multiple accounts on the site.

In the past, Facebook has worked with various states on legislation to help law enforcement find, prosecute and convict sexual predators who attempt to use the site.