DETROIT (AP) — A federal judge told state officials Friday that the Michigan Legislature needs to bring portions of its sex offender registry law into compliance with constitutional requirements.

The order could be effective 60 days after a final judgment is entered. If the state does not bring the law into compliance, it no longer can enforce it against people on the registry with offenses before April 12, 2011, wrote U.S. District Judge Robert Cleland.

The ruling is part of a class action lawsuit filed by the American Civil Liberties Union of Michigan, the University of Michigan Clinical Law Program and the Oliver Law Group on behalf of people listed on the registry.

The Associated Press left a message Friday for the state attorney general’s office seeking comment.

Michigan lawmakers changed the law in 2006 to prohibit registrants from living, working or even loitering within 1,000 feet of a school. Five years later, the Legislature said registrants should be divided into three tiers solely on the type of conviction, not based on any individual assessment. The rules were made retroactive.

“The court anticipates that its ruling will re-ignite efforts to finalize a new, unified registration statute that can survive constitutional review,” Cleland wrote.

The ACLU and others have pressed for changes to the law and the U.S. Supreme Court in 2017 let stand a federal appeals court decision that found Michigan was treating people as “moral lepers” by saddling them with excessive restrictions.

Attorney Miriam Aukerman with the ACLU of Michigan called the registry “an ineffective and bloated system,” and said it sabotages “people’s efforts to re-enter society” and wastes “scarce police resources on hyper-technicalities.”

“Today’s decision means that lawmakers must finally do their jobs and pass evidence-based laws that better serve everyone,” said Aukerman.