FILE - In this June 26, 2017, file photo, Lydia Balderas, left, and Merced Leyua, right, join others as they protest against a new sanctuary cities bill outside the federal courthouse in San Antonio. President Donald Trump's executive order threatening to withhold funding from "sanctuary cities" that limit cooperation with immigration authorities is unconstitutional, but a judge went too far when he blocked its enforcement nationwide, a U.S. appeals court ruled Wednesday, Aug. 1. (AP Photo/Eric Gay, File)

FILE - In this June 26, 2017, file photo, Lydia Balderas, left, and Merced Leyua, right, join others as they protest against a new sanctuary cities bill outside the federal courthouse in San Antonio. President Donald Trump's executive order threatening to withhold funding from "sanctuary cities" that limit cooperation with immigration authorities is unconstitutional, but a judge went too far when he blocked its enforcement nationwide, a U.S. appeals court ruled Wednesday, Aug. 1. (AP Photo/Eric Gay, File)

SAN FRANCISCO (AP) — A divided U.S. appeals court on Wednesday struck down a key part of President Donald Trump’s contentious effort to crack down on cities and states that limit cooperation with immigration officials, saying an executive order threatening to cut funding for “sanctuary cities” was unconstitutional.

In a 2-1 decision, the 9th U.S. Circuit Court of Appeals agreed with a lower court that the order exceeded the president’s authority. Congress alone controls spending under the U.S. Constitution, and presidents do not have the power to withhold funding it approves to pursue their policy goals, the court majority said.

ADVERTISEMENT

“By its plain terms, the executive order directs the agencies of the executive branch to withhold funds appropriated by Congress in order to further the administration’s policy objective of punishing cities and counties that adopt so-called ‘sanctuary’ policies,” wrote Chief Judge Sidney Thomas, joined by Judge Ronald Gould, who both were nominated by Democratic President Bill Clinton.

The court, however, also said the lower-court judge went too far when he blocked enforcement of Trump’s order nationwide after a lawsuit by two California counties — San Francisco and Santa Clara.

Thomas said there wasn’t enough evidence to support a nationwide ban, limited the injunction to California and sent the case back to the lower court for more arguments on whether a wider ban was warranted.

Devin O’Malley, a spokesman for the U.S. Justice Department, called the 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 decision overall is a big win for opponents of the executive order, but Trump could try to enforce it against jurisdictions outside the nine Western states covered by the 9th Circuit, said David Levine, an expert on federal court procedure at the University of California, 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.”

ADVERTISEMENT

Trump signed the executive order in January 2017 — part of a push by his administration to go after 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.

The executive order potentially jeopardized hundreds of millions of dollars in funding to San Francisco and Santa Clara 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.

Fernandez, who was nominated to the 9th Circuit by Republican President George H.W. Bush, said Orrick had pushed that language aside. Fernandez called the counties’ fears about the order an “imagined beast.”

___

This story has been corrected to reflect that the 9th Circuit covers nine Western states.