A federal judge in Minneapolis has ordered West St. Paul officials to allow a convicted sex offender to remain in his home pending the outcome of his lawsuit challenging the constitutionality of a city ordinance restricting where sex offenders can live.

The order, issued by Chief U.S. District Judge John Tunheim Thursday morning, offers a momentary victory for Thomas Wayne Evenstad because the judge found that Evenstad is likely to succeed in his lawsuit.

Despite the fact that federal courts have ruled in favor of sex offender residency restrictions in the past, West St. Paul’s rule may be overly restrictive, Tunheim said in his order.

“The case presents a close call,” he wrote. “But the court finds simply that West St. Paul has gone too far in the sweep of its ordinance. No one disputes that a city has a strong interest in protecting its citizens. Indeed, a more narrowly drawn ordinance would likely pass muster.”

Tunheim was persuaded by Evenstad’s lawyers that the city went too far by barring all sex offenders — regardless of any risk assessment — from living within 1,200 feet of schools, day cares, group homes and residential-care establishments. He said the ordinance was doomed in part by the exclusion around group homes.

Adele Nicholas, one of Evenstad’s Chicago-based attorneys, said she was pleased with the ruling.

“This is not a final decision,” Nicholas said. “But it is a very good step in the right direction.”

Cliff Greene, one of the city’s attorneys, said the judge found some merit in the city’s arguments, even if he didn’t rule in its favor.

“The judge found some distinguishing characteristics, but it’s clear that the law [we cited] applies,” Greene said. “We have to give some thought to what our next steps will be.”

Eric Janus, a professor at Mitchell Hamline School of Law, called Tunheim’s order significant.

“It’s essentially saying this is a punitive piece of legislation, given the breadth of it and the restrictiveness of it,” Janus said.

Evenstad, 52, was convicted in 1999 of first-degree criminal sexual assault against an 18-year-old woman. He was deemed by the state to be a Level 1 sex offender, the least likely to reoffend.

In August, he was released from jail for another crime — a probation violation related to a 2014 conviction for felony stalking — and moved into a West St. Paul duplex, violating a city ordinance adopted in 2016 restricting where sex offenders can live.

His landlord, Dale Wilkinson, is a family friend who wanted to help him get a fresh start.

West St. Paul police informed Evenstad’s landlord that his tenant couldn’t live there because the residence was within 1,200 feet of a day-care center and two group homes. Both the landlord and Evenstad could be charged with a crime unless he moved within 10 days, police said.

Evenstad sued in August and won a temporary restraining order that barred the city from evicting him. Tunheim issued a preliminary injunction Thursday.

Evenstad said he’s relieved by Thursday’s order. The prospect of having to find a new place to live has been stressful and frightening, Evenstad said.

He added that Tunheim’s order was a significant victory. “The reality is that we definitely won a major, major battle in the war of this lawsuit,” Evenstad said.