A federal appeals court has struck down a series of harsh restrictions imposed by Michigan’s state legislature on previously convicted sex offenders on the grounds that they constituted punishment above, beyond and sometimes long after their sentencing, in violation of the Constitution’s prohibition on retroactive or “ex post facto” laws.

The closely watched case stemmed from amendments in 2006 and 2011 to Michigan’s sex offender registry law — similar to those on the books known as “Megan’s Law” in states across the country — that were imposed retroactively on people convicted and sentenced before they were enacted.

The central question was whether they were punitive in nature, effectively adding to the punishments already meted out, which would violate the Constitution’s bar on ex post factor laws, or whether they were public safety regulatory measures designed to prevent recidivism and protect the public, as Michigan contended.

“It is not intended to punish and does not otherwise impose effects similar to punishment,” the state argued. It is “regulatory not punitive.”

The appeals court ruled that they were unquestionably major in their impact and unquestionably punitive and struck them down. The court compared them with ancient banishment laws and laws aimed at public shaming.

Sex offender registry laws apply to a variety of crimes, ranging from brutal assaults and child molestation to sexual contact between teenagers (when one is over 18 and the other isn’t) to certain kidnapping charges that don’t involve sexual assault at all.

They’ve been criticized as ineffective and going well beyond the original intent behind them — to protect the public.

In addition to having their names put on a registry available to the public, the amendments in Michigan prohibited those subject to them from living, working or “loitering” within 1,000 feet of a school.

The amendments also ranked the offenders according to their perceived dangerousness, without any examination of their current status in life, and required them to appear in person to update new information about them, such as the purchase of a new vehicle or the opening of an email account.

They were challenged by six sex offenders, five men and a woman, identified only as John Does and Mary Doe who were represented the American Civil Liberties Union. They lost their case in a lower court and appealed.

Writing for the three-judge panel of the U.S. Court of Appeals for the 6th Circuit, Judge Alice Batchelder, in holding the amendments to be punitive, said they “had a significant impact” that reached “far beyond the stigma of simply being identified as a sex offender on a public registry.

“As a result of the school zone restrictions, for example, many of the Plaintiffs have had trouble finding a home in which they can legally live or a job where they can legally work. These restrictions have also kept those Plaintiffs who have children (or grandchildren) from watching them participate in school plays or on school sports teams, and they have kept Plaintiffs from visiting public playgrounds with their children for fear of ‘loitering.'”

The state’s law resembles “the ancient punishment of banishment,” she wrote, in its burden on where the registrants can live and where they can come and go.

They “also resemble traditional shaming punishments,” imposed without any assessment of the registrant’s current status.

“Michigan points out that these restraints are not physical in nature and contends that the actual effects are therefore ‘minor and indirect’ … But surely something is not ‘minor and indirect’ just because no one is being lugged off in cold irons bound,” the judge wrote. “Indeed, those irons are always in the background since failure to comply with these restrictions carries with it the threat of serious punishment, including imprisonment.”

The court added there was no credible evidence that such laws prevent recidivism or really protect the public. Rather, Batchelder wrote, they are “retributive,” marking “registrants as ones who cannot be fully admitted into the community.”

The law “brands registrants as moral lepers solely on the basis of prior conviction,” she wrote, consigning them to “years, if not a lifetime, of existence on the margins, not only of society, but often … from their families, with whom, due to school zone restrictions, they may not even live.”

The court concluded that the amendments imposed punishment and “punishment may never be retroactively imposed or increased.”

The decision would not have any impact on individuals convicted after the amendments were enacted.

The issue came up in the U.S. Supreme Court in a 2003 case from Alaska called Smith v. Doe. In that case, the high court upheld a retroactive sex registry law, saying it was a “non-punitive” civil rather than criminal regulatory law that was acceptable.

The court in the Michigan case distinguished the cases, saying the Alaska law was strictly a registration requirement, without the extensive restrictions of Michigan’s statute, which it compared to “the punishment of parole/probation” in its reach.

The Detroit Free Press, in a 2015 investigation, determined that the state had the fourth highest number of people per capita on its registry, with 42,700 registrants. It also cited research suggesting that the “registries do little to protect communities and often create ongoing misery for some who served their sentences and are unlikely to re-offend.”