A U.S. appeals court ruled Wednesday it is unconstitutional for the Trump administration to threaten to withhold funding from “sanctuary cities” that aren’t cooperating with immigration officials.

"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.

In a 2-1 ruling, Thomas also said he's sending back the case back to the lower court because there wasn't enough evidence to support a nationwide ban on Trump's executive order. The case will receive more hearings on the nationwide ban question.

SANCTUARY CITIES: WHAT ARE THEY?

In November, U.S. District Judge William Orrick issued an injunction to permanently block President Trump's executive order to cut off funding to sanctuary cities. The judge said the president didn’t have the authority to attach new conditions to spending approved by Congress, adding that the president's efforts also violated the separation of power doctrines.

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

A federal judge also ruled last Friday that the U.S. Justice Department cannot withhold grants from Chicago because it was providing sanctuary to immigrants.

Trump promised to crack down on sanctuary cities, claiming they were “harboring” illegal immigrants. The administration said the executive order signed in January 2017 only applies to a small monetary fund that already requires compliance with immigration law.

The Associated Press contributed to this report.