Devin O'Malley, a spokesman for the U.S. Justice Department, said the president's order was legal. He called the court's ruling a victory for "criminal aliens in California, who can continue to commit crimes knowing that the state's leadership will protect them from federal immigration officers whose job it is to hold them accountable and remove them from the country."
"The Justice Department remains committed to the rule of law, to protecting public safety and to keeping criminal aliens off the streets," he said.
The court, however, also said there wasn't enough evidence to support a nationwide ban on Trump's order. It limited the injunction and sent the case back to the lower court for more arguments on whether such a ban was warranted.
The decision overall is a big victory for opponents of the executive order, but Trump could try to enforce it against jurisdictions outside the 10 Western states covered by the 9th Circuit, said David Levine, an expert on federal court procedure at the UC Hastings College of Law.
"If they wanted to go after Chicago, if they wanted to go after Denver or Philadelphia, they would not be bound by an injunction," he said. "Those places would have to bring their own lawsuits and whatever happens, happens in those cases."
Trump signed the executive order in January 2017 — part of a push by his administration to crack down on cities and states that don't work with U.S. immigration authorities.
The government also has moved to withhold a particular law enforcement grant from sanctuary jurisdictions and sued California over three laws that extend protections to people in the country illegally.
The Trump administration says sanctuary cities and states allow dangerous criminals back on the street. San Francisco and other sanctuary cities say turning local police into immigration officers erodes the trust needed to get people to report crime.
The executive order directed the attorney general and secretary of Homeland Security to ensure that jurisdictions refusing to comply with a particular immigration law generally are not eligible to receive U.S. grants.
U.S. District Judge William Orrick in San Francisco ruled in November that the order threatened all federal funding and that the president lacked the authority to attach new conditions to spending approved by Congress.
His ruling came in lawsuits filed by two California counties — San Francisco and Santa Clara. The executive order potentially jeopardized hundreds of millions of dollars in funding to the two counties, Orrick said, citing comments by Trump and U.S. Attorney General Jeff Sessions as evidence of the order's scope.
The Trump administration said the order applied to a relatively small pot of money that already required compliance with the immigration law.
"When a president overreaches and tries to assert authority he doesn't have under the Constitution, there needs to be a check on that power grab," San Francisco City Attorney Dennis Herrera said in a statement Wednesday. "The courts did that today, which is exactly what the framers of the Constitution had in mind."
Santa Clara County Counsel James R. Williams said the decision was a victory for a key provision of the U.S. Constitution.
In a colorful dissenting opinion, 9th Circuit Judge Ferdinand Fernandez said the executive order clearly says any action by the attorney general or Homeland Security secretary was to be taken in accordance with the law. He said Orrick had pushed that language aside and called the counties' fears about the order an "imagined beast."