(Reuters) - An Iowa federal judge has temporarily blocked the Republican-led state's law allowing for the arrest and prosecution of people who are in the U.S. illegally, in a win for the Biden administration.

U.S. District Judge Stephen Locher in Des Moines, Iowa, said in a written decision late Monday that the law, which was set to take effect July 1, would interfere with the federal government's enforcement of U.S. immigration laws.

Iowa is one of several states where Republican officials critical of Democratic President Joe Biden's border policies have passed laws aimed at increasing states' powers to address illegal immigration, a top issue in the run-up to the November presidential election.

"As a matter of politics, the new legislation might be defensible. As a matter of constitutional law, it is not," Locher wrote in his decision.

The judge blocked the law from taking effect pending the outcome of consolidated lawsuits by the Biden administration and civil rights groups seeking to strike it down permanently.

Iowa Attorney General Brenna Bird, a Republican who took office last year, said in a statement that her office would appeal the ruling.

"Since Biden refuses to secure our borders, he has left states with no choice but to do the job for him," Bird said.

The groups that sued to block the law praised the decision. Rita Bettis Austen, legal director of the American Civil Liberties Union's Iowa chapter, called the law "among the worst anti-immigrant legislation in Iowa's history."

"Local law enforcement in Iowa have spoken up to say that they don't want this duty, given the significant ways that such enforcement would erode the ability of local law enforcement to protect public safety," Austen said in a statement.

The U.S. Department of Justice did not immediately respond to a request for comment.

Iowa's law makes "illegal reentry" into the state a crime punishable by up to two years in prison and authorizes state judges to order that individuals return to their home countries after serving sentences.

A U.S. appeals court in March blocked a similar Texas law that also allows state officials to arrest, prosecute and order the removal of suspected migrants, while it considers the state's appeal of a judge's ruling that said it was invalid.

And the Biden administration is challenging an Oklahoma law that makes it a state crime to lack immigration status, punishable by up to one year in prison.

(Reporting by Daniel Wiessner in Albany, New York; Editing by Alistair Bell)

By Daniel Wiessner