A federal judge has ruled in favor of sex offenders against a Georgia sheriff who was attempting to protect trick-or-treaters from predators.

Butts County Sheriff Gary Long had placed “no trick-or-treat” signs in the lawns of registered sex offenders as a community warning, ahead of the holiday.

Three of the sex offenders filed a class-action lawsuit last week and U.S. District Court Judge Marc Treadwell has sided with them and granted a preliminary injunction. The sex offenders claimed that the sheriff was trespassing and violated their constitutional rights against forced speech.

The judge agreed that the signs violated their First Amendment rights.

TRENDING: BREAKING: Multiple Injuries After Car Plows Through Crowd of Trump Supporters in Yorba Linda, California (VIDEO)

“The question the Court must answer is not whether Sheriff Long’s plan is wise or moral, or whether it makes penological sense,” the judge said in his ruling. “Rather, the question is whether Sheriff Long’s plan runs afoul of the First Amendment of the United States Constitution. It does.”

The sex offender registry in Georgia is public and anyone can look up their names, photos, and current addresses, but the judge claims this fact “does not require or authorize sheriffs” to place signs outside their homes, according to a report from NBC News.

“To be clear, this injunction in no way limits Sheriff Long’s discretion to act on specific information suggesting a risk to public safety,” the judge wrote. “But he cannot post the signs over the named Plaintiffs’ objections simply because their names are on the registry.”

Sheriff Long posted about his dismay regarding the ruling on Facebook, but promised an increased law enforcement presence in those neighborhoods on Halloween night. The post also included a link to see where sex offenders are located.