SAN FRANCISCO — A U.S. appeals court says President Trump's executive order threatening to withhold funding from "sanctuary cities" that limit cooperation with immigration authorities is unconstitutional.

But the 9th U.S. Circuit Court of Appeals said Wednesday that a lower court went too far when it blocked the order nationwide.

U.S. District Judge William Orrick said in November that Mr. Trump's order threatened all federal funding and that the president didn't have the authority to attach new conditions to spending approved by Congress.

Get Breaking News Delivered to Your Inbox

The ruling came in lawsuits filed by two California counties — San Francisco and Santa Clara.

The Trump administration said the order applies to a relatively small pot of money that already requires compliance with immigration laws.

An email to a spokesman for the U.S. Justice Department wasn't immediately returned.