President Trump lost another round in his legal battle over sanctuary cities Thursday as a federal appeals court ruled that he could not force localities to let deportation officers into their prisons and jails to go after illegal immigrants.

The administration promised to continue to fight, saying the decision by the 7th U.S. Circuit Court of Appeals was wrong and the nationwide injunction the court upheld was too broad.

But for now, the ruling undercuts Mr. Trump’s threat to cut off federal funding from states, cities and counties that refuse to let immigration authorities into their facilities, or that refuse to tell the government when deportation targets are about to be released from custody.

The court, in grandiose language, cast itself as a defender against Mr. Trump’s bid at “tyranny.”

“If the Executive Branch can determine policy, and then use the power of the purse to mandate compliance with that policy by the state and local governments, all without the authorization or even acquiescence of elected legislators, that check against tyranny is forsaken,” wrote Judge Ilana Rovner, who was named to the appeals court by President George H.W. Bush.

Her ruling does not eliminate the requirement that localities allow their police to communicate with Homeland Security officials, which is explicitly written into federal law.

But she said Mr. Trump and Attorney General Jeff Sessions went too far when they tried to add more conditions — namely the jail access and prisoner release alerts.

The case stems from Chicago, which pioneered one of the most expansive sanctuary city policies more than a decade ago.

Other legal battles over sanctuary cities are playing out in California, where several cities and the state have challenged Mr. Sessions, and in Philadelphia.

The administration has suffered defeats at each level.

Chicago’s defenders said the ruling means the city can keep accessing federal grant money to deal with gun violence or other local problems.

Sen. Richard J. Durbin, Illinois Democrat, said Mr. Sessions overreached by trying to back up Mr. Trump’s campaign promises.

“It was a dangerous and irresponsible decision to pressure local communities to join in the president’s mass deportation agenda, and I’m glad the 7th Circuit has upheld this injunction,” he said.

The appeals court judges said they weren’t ruling on the wisdom of sanctuary cities, but were defending Congress’ control over the power of the purse. It’s up to Capitol Hill to attach conditions to federal money, and the president can’t add his own strings, the court said.

The judges said Congress had plenty of chances to attach the conditions Mr. Sessions sought. Bills to do just that have come up a number of times. Though some have cleared the House, none has been approved by the Senate.

Judge Daniel A. Manion, a Reagan appointee to the bench, filed an opinion that sided with the ruling as it pertains to Chicago but objected to applying the decision nationwide. He said the court should rule only on the parties in the case in front of it.

“Other jurisdictions that do not want to comply with the Notice and Access conditions were not parties to this suit, and there is no need to protect them in order to protect Chicago,” he wrote.

Indeed, the issue of nationwide injunctions has become just as important as the sanctuary debate. Lawyers said the Supreme Court will have to get involved and decide how far judges in one district or state can go in tying the president’s hands nationally.

Justice Department spokesman Devin O’Malley called it “a dangerous precedent.”

“We will continue to fight to carry out the department’s commitment to the rule of law, protecting public safety and keeping criminal aliens off the streets to further perpetrate crimes,” he said.

Mr. Trump, hours after the ruling, took to Twitter to blast sanctuary cities.

“Sanctuary Cities released at least 142 Gang Members across the United States, making it easy for them to commit all forms of violent crimes where none would have existed,” he said. “We are doing a great job of law enforcement, but things such as this make safety in America difficult!”

He identified sanctuary cities as a major menace early in his 2015 campaign, using the death of Kate Steinle, just days after he announced his presidential campaign, as a symbol of the problem.

Steinle was killed while walking along the San Francisco waterfront by an illegal immigrant who had been deported repeatedly but had sneaked back into the U.S. and was being shielded by the city’s sanctuary policy.

Once Mr. Trump won office, California enacted three statewide sanctuary laws severely restricting cooperation with federal immigration officials. Mr. Sessions has sued to overturn the laws, and some communities in the state have rebelled by voting to back Mr. Sessions’ lawsuit and to declare themselves exempt from the state law.

The first of those rebels, Los Alamitos, now faces its own backlash.

Immigrant rights advocates announced Wednesday that they are suing the city, claiming state law takes precedence.

“These racist stunts don’t work here. They’re backfiring,” Salvador G. Sarmiento, an organizer for the National Day Laborer Organizing Network, said in an email to supporters. NDLON is one of the groups leading the lawsuit.

Sign up for Daily Newsletters Manage Newsletters

Copyright © 2020 The Washington Times, LLC. Click here for reprint permission.