NEW YORK/SAN FRANCISCO (Reuters) - A U.S. appeals court on Thursday backed the Trump administration in its attempt to deport from the United States about 100 Iraqi immigrants who had been convicted of crimes years ago.

A divided 6th U.S. Circuit Court of Appeals panel reversed a lower court ruling that had blocked U.S. President Donald Trump’s bid to send the immigrants back to Iraq. The appeals court also disagreed with the Michigan federal judge’s order that the immigrants receive bail hearings.

In 2017, the Trump administration detained the Iraqis as part of a broad effort to ramp up immigration enforcement across the country. Many of the Iraqis had been ordered deported years or decades ago because of criminal offenses but had not been deported because their home country would not take them back.

“Though many of these Iraqi nationals had come to expect that the execution of their removals would never materialize, they had been living in the United States on borrowed time,” the appeals court ruling said.

The Iraqis challenged their detentions and deportation orders in court.

In November, U.S. Judge Mark Goldsmith in Michigan ordered the administration to release anyone held longer than six months while the U.S. government sought to carry out the deportation orders.

The U.S. government said it had an agreement with Iraq to take the deportees back. But Goldsmith in his ruling criticized the Trump administration for making “demonstrably false” statements about the Iraqi government’s cooperation.

Two appeals court judges on the three-judge panel overturned Goldsmith’s ruling, saying the district court lacked the jurisdiction to rule on removal orders, which are overseen by the attorney general and the immigration courts. The appeals court judges also said the lower court lacked jurisdiction to rule on the detention claims.

Steven Stafford, a spokesman for the Justice Department, said in a statement that the injunctions had “undercut the Executive Branch’s authority and duty to detain and remove aliens - aliens who had been ordered removed from the United States long ago.”

Appellate Judge Helene White wrote a dissenting opinion saying the lower court does have jurisdiction over the claims.

She wrote that the petitioners presented evidence that they were likely to be killed or tortured if deported. “The government did not contest this evidence,” she wrote.