A federal judge in Georgia ruled that a sheriff's placing "No Trick-or-Treat" signs outside the homes of registered sex offenders violated their constitutional rights.

U.S. District Court Judge Marc Treadwell granted a preliminary injunction Tuesday barring Sheriff Gary Long in Butts County from the putting the warning signs outside the homes of the three offenders who sued over the practice.

The class-action lawsuit by the three plaintiffs said it represented all of the registered sex offenders in Butts County, about 52 miles southeast of Atlanta.

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

The decision agreed with the sex offenders' contention that the signs were a form of forced speech. The posters forced the offenders to accept the sheriff's "message that their homes are unsafe, the ruling said.

Sheriff Long and his deputies placed the posters in offenders' yards last Halloween, and the sheriff wanted to do it again this year to "ensure the safety of our children," he wrote in a Facebook post last week.

The large white signs included images of two stop signs, the "no" symbol across a Halloween bag and the message: "WARNING! NO TRICK-OR-TREAT AT THIS ADDRESS!!"

Long said in a Facebook statement on Tuesday that he "respectfully and strongly" disagrees with the ruling.

"For this Halloween, our Deputies will keep a very strong presence in the neighborhoods where we know sex offenders are likely to be," he wrote. "Deputies will have candy in their patrol vehicles and will interact with the children until the neighborhood is clear of Trick-or-Treaters."

The sex offenders argued in their lawsuit that the placing of the signs violated laws against trespassing on private property in addition to their constitutional rights against forced speech. The suit also said that one deputy told an offender that if he removed the sign he would be arrested.

Under Georgia law, the names, photos and addresses of sex offenders are made available to the public, but Judge Treadwell's ruling said the "statute does not require or authorize sheriffs to post signs in front of sex offenders’ homes."

The posters were "dubious at best and even more dubious if posted over the objection of registrants," the ruling said.

"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" of sex offenders.