SAN FRANCISCO — The United States 9th Circuit Court of Appeals ruled Wednesday that President Donald Trump's executive order blocking federal grants to so-called "sanctuary cities" is unconstitutional. 

By a 2-to-1 ruling, the court decided that the Trump administration could not withhold federal funding from "immigrant-friendly" cities and counties in California.

“Absent congressional authorization, the administration may not redistribute or withhold properly appropriated funds in order to effectuate its own policy goals,” Chief Judge Sidney Thomas wrote for the majority.

But he also said there wasn’t enough evidence to support a nationwide ban on the order and sent the case back to the lower court for more hearings on that question.

The ruling upholds an earlier decision by a district judge in favor of the counties of San Francisco and Santa Clara. The counties filed suit against the Trump administration over threats made to federal funding going to cities that passed legislation limiting local law enforcement cooperation with federal immigration agencies.

An email to a spokesman for the U.S. Justice Department was not immediately returned.

President Trump signed the executive order just five days after he was sworn into office in 2017. His administration has sued California over three laws aimed at protecting immigrants in the country illegally.

It also has moved to block a key public safety grant from going to sanctuary cities and states.

Information from the Associated Press was used in this report.