(Reuters) - A U.S. judge on Tuesday ruled that the government cannot immediately deport nearly 200 Iraqi immigrants arrested last month who argued they would face persecution if they were removed from the country.

U.S. District Judge Mark Goldsmith in Michigan said he had the authority to order the government to keep the Iraqis in the county while their deportation cases were reviewed by the courts.

In his ruling, Goldsmith said sending the Iraqis back now would expose them to a "substantiated risk of death, torture, or other grave persecution before their legal claims can be tested in a court."

Many of the 199 Iraqis detained - largely in the Detroit area but also in Tennessee, New Mexico and California - were Chaldean Catholics and Iraqi Kurds. Both groups said they could be targeted for attacks in Iraq because they are visible minorities. The government is seeking to deport over 1,400 Iraqis across the country, the ruling said.

The actions are part of Trump administration efforts to increase immigration enforcement and make countries take back nationals ordered out of the United States.

The Iraqis arrested by immigration authorities had outstanding deportation orders and many had been convicted of serious crimes, ranging from homicide to weapons and drug charges, according to the U.S. government.

Goldsmith said federal courts were "first responders" if constitutional rights were under threat and the Iraqis' extraordinary circumstances gave him the power to block their deportation.

A Justice Department spokeswoman declined to comment.

The department has argued that only immigration courts have the authority to decide the Iraqis' status.

The American Civil Liberties Union, which represents the Iraqis, said in a statement: "Federal courts must be able to ensure that the government acts according to the law, particularly where people's lives are at stake."

Some of those arrested committed crimes decades ago and had been allowed to remain in the United States because Iraq until recently refused to issue them travel documents.

That changed after Baghdad agreed in March to accept U.S. deportees as part of a deal to remove the country from President Donald Trump's revised temporary travel ban.

In a statement, Michigan Rep. Sander Levin, a Democrat, applauded Goldsmith's ruling, saying it would give courts time "to learn all of the facts related to these individuals."

Goldsmith scheduled a hearing for Thursday on the next steps in the litigation.

(Reporting by Dan Levine in San Francisco; Editing by James Dalgleish and Andrew Hay)