A federal appeals court ruled today that President Trump does not have the authority to withhold federal funding from so-called sanctuary cities and counties.

Upholding a lower court decision, the U.S. 9th Circuit Court of Appeals said the power to allocate federal funding belongs to Congress: “The Executive Branch may not refuse to disperse the federal grants in question without congressional authorization.”

Last year, U.S. District Judge William H. Orrick III in San Francisco issued a national injunction against an executive order that Trump issued five days into his presidency. The president’s order directed that federal monies be withheld from “sanctuary” jurisdictions such as San Francisco.

San Francisco and the County of Santa Clara, which have declared themselves sanctuary jurisdictions, limiting cooperation with federal immigration authorities, sued the Trump administration.

Orrick said Trump’s order was unconstitutional, violating the Separation of Powers doctrine and the Fifth and Tenth amendments.

Today, the 9th Circuit panel of judges agreed but removed his injunction, except in California, citing a lack of evidence to keep it in place elsewhere and returning it for reconsideration. The judges said California, specifically San Francisco and Santa Clara counties, are “likely targets” of Trump’s order and retained it for the state.

The federal Justice Department denounced the decision on funding as “a victory for criminal aliens in California.” The state “will protect them from federal immigration officers whose job it is to hold them accountable and remove them from the country,” spokesman Devin O’Malley said in a written statement.

California laws limiting cooperation with federal immigration agents went into effect this year. Dozens of local governments have dissented, suing the state, joining a federal lawsuit against the policy or taking other actions.