SAN FRANCISCO (AP) — A federal judge on Monday permanently blocked President Donald Trump’s executive order to cut funding from cities that limit cooperation with U.S. immigration authorities.

U.S. District Court Judge William Orrick rejected the administration’s argument that the executive order applies only to a relatively small pot of money and said Trump cannot set new conditions on spending approved by Congress.

The judge had previously made the same arguments in a ruling that put a temporary hold on the executive order targeting so-called sanctuary cities. The Trump administration has appealed that decision to the 9th U.S. Circuit Court of Appeals.

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

Orrick’s ruling came in lawsuits brought by two California counties, San Francisco and Santa Clara.

San Francisco City Attorney Dennis Herrera said the ruling was “a victory for the American people and the rule of law.”

“President Trump might be able to tweet whatever comes to mind, but he can’t grant himself new authority because he feels like it,” he said in a statement.

A lawyer for the DOJ argued during a hearing before Orrick in April that the executive order applied to only a few grants that would affect less than $1 million for Santa Clara County and possibly no money for San Francisco.

But the judge disagreed, saying in his rulings that the order was written broadly to “reach all federal grants” and potentially jeopardized hundreds of millions of dollars in funding to San Francisco and Santa Clara.

He cited comments by the president and Attorney General Jeff Sessions as evidence that the order was intended to target a wide array of federal funding. And he said the president himself had called it a “weapon” to use against recalcitrant cities.

The Trump administration separately has also moved to withhold one particular law enforcement grant from sanctuary cities, prompting a new round of lawsuits that are pending.