A Hennepin County judge has struck down a far-reaching ordinance in Dayton, Minn., that restricts where sex offenders can live, ruling that the measure is trumped by state law.

The decision concerns a city ordinance that effectively barred convicted sex offenders from living anywhere in the city of Dayton, a semirural community of about 5,000 residents northwest of the Twin Cities. The measure was hastily passed by the Dayton City Council in late 2016 after residents raised alarms over plans by the state to move three convicted rapists from Minnesota's sex offender treatment program to a group home in the city.

In her ruling, Hennepin County District Judge Susan Robiner declared the ordinance "void and invalid" because it was expressly designed to conflict with a state law that establishes a legal process for releasing civilly committed sex offenders from the Minnesota Sex Offender Program (MSOP) and reintegrating them into society. Such ordinances, the judge added, would have a "devastating effect" on the MSOP's ability to discharge offenders from the program.

The decision marks the second time this year that a judge in Minnesota has ruled against a local ordinance restricting where sex offenders can live, and it could mark a turning point in the struggle between state officials and local governments over efforts to integrate offenders into the community. Nearly 90 localities across Minnesota, from Pine Island to Cloquet, have adopted such bans — effectively making large swaths of the state off-limits to offenders who have already served their prison terms and are legally entitled to live in the community.

So many cities and counties have passed sex-offender residency restrictions in recent years that the state is running out of places to house offenders from the MSOP, even as they face court pressure to release more of them.

"This is potentially a major precedent," said Eric Janus, a professor at Mitchell Hamline School of Law and author of a book on sex offender laws and policy. "This ruling is a clear statement that it's counterproductive to have a patchwork quilt of rules ... that interferes with the state's ability to reintegrate people effectively."

Local ordinances that restrict sex offender residency have existed in Minnesota for more than a decade, but there was a rush to craft more of them in the wake of a major constitutional challenge to the state's sex offender laws. In 2015, U.S. District Judge Donovan Frank declared that the state could no longer confine offenders at the MSOP indefinitely without a clear path toward release and ordered the state to develop more options for housing offenders in the community.

Fearing a sudden release of convicted rapists and child molesters into their communities, the number of jurisdictions that adopted residency restrictions swelled from fewer than 40 in 2015 to some 89 communities statewide, according to the Minnesota Department of Corrections. The ordinances vary widely in scope. Most bar sex offenders from living near parks, day cares, playgrounds, schools and other areas with children.

Some of the ordinances are so sweeping that the towns have effectively become off-limits to offenders.

The city of Dayton's measure barred convicted sex offenders from living within 2,000 feet of any school, church, day care provider, park, playground or public bus stop — even "a seasonal pumpkin patch or apple orchard" — within the city. It also barred them from athletic fields, ice skating rinks, bowling alleys, dance academies and public libraries. The ordinance was so specific that it even prohibited offenders from handing out candy on Halloween or leaving an exterior porch light on to invite trick-or-treaters.

Judge Robiner said such varying laws "create a patchwork of different rules" that interfere with the state's statutory responsibility to integrate civilly committed offenders back into society. "Any provisional discharge [from the MSOP] would become impossible if every municipality in Minnesota created a similar ordinance," Robiner wrote in the 11-page decision.

After a closed-door City Council meeting early Tuesday, the city issued a written statement saying it does not intend to appeal the ruling, but is exploring "legislative solutions," since the decision could affect other cities with similar ordinances.

Dayton Mayor Tim McNeil said the ruling "stands as a warning" to all the state's residents. "Unless the Legislature and governor can act to ensure that locally elected officials have at least some say in the placement of our most dangerous sexual predators, no individual is safe from a system that has no interest in getting input at the local level," he said.

The three offenders seeking to move to Dayton are older men with long and violent histories. They are Ben Braylock, 87, who was convicted of stabbing his wife to death in 1981 and, after serving prison time for the murder, was convicted of raping two teenage girls; Demetrius A. Mathews, 55, who was sentenced to prison in 1983 for raping his 12-year-old niece, and later admitted to molesting a 3-year-old girl; and Marvin L. Breland, 60, who was convicted in three separate cases of forcing women into sexual acts while threatening them with weapons, according to court records.

All three men have been cleared for conditional release to a group home in Dayton, but remain at the MSOP's treatment facility in St. Peter.

Human Services Commissioner Emily Piper, whose agency oversees the sex offender program, had warned of a legal challenge soon after Dayton's ordinance passed. "Although it's not popular, when courts order [the Department of Human Services] to place sex offenders in communities, local governments can't have veto rights over that decision," Piper said in a statement Tuesday.

Criminal justice researchers have found that residency restrictions are largely ineffective at preventing sex crimes, in part because those who reoffend tend to victimize people they know rather than pursue strangers living near them.

In a comprehensive study, research director Grant Duwe at the state Department of Corrections analyzed the offense patterns of every sex offender released from Minnesota correctional facilities between 1990 and 2002 who was reincarcerated for a new sex offense. Of 224 sexual reoffenses in the study, he found that not a single one would have been prevented by a residency law. Of the few offenders who contacted a juvenile victim near their homes, none did so near a school, park, playground or other location included in residency restriction laws, he found.

"By all indications, residency restrictions don't make communities safer, though they may make communities feel safer," said Jon Brandt, a social worker who has worked with sex offenders in Minnesota for more than 30 years.

Residency restriction laws can actually increase risk to the community by pushing offenders "further into the shadows," said Janus of Mitchell Hamline. "We know that for [offenders] to integrate successfully they need community support and the ability to have a job and a place to live," he said. "The absence of those things leads to instability and has the danger of actually increasing recidivism."

Chris Serres • 612-673-4308 Twitter: @chrisserres