A California judge on Tuesday blocked President Trump’s executive order that sought to withhold federal funds from so-called “sanctuary cities.”

The ruling from U.S. District Judge William Orrick III in San Francisco said that Trump's order targeted broad categories of federal funding for sanctuary governments, and that plaintiffs challenging the order were likely to succeed in proving it unconstitutional.

The decision will block the measure for now, while the federal lawsuit works its way through the courts.

READ THE DECISION

The news comes on the heels of the Department of Justice threatening on Friday to cut off funding to eight so-called “sanctuary cities,” unless they were able to provide proof to the federal government that they weren’t looking the other way when it came to undocumented immigrants.

San Francisco and Santa Clara County argued that the administration warning threatened billions of dollars in funding for each of them, making it difficult to plan budgets.

"It's not like it's just some small amount of money," John Keker, an attorney for Santa Clara County, told Orrick at the April 14 hearing.

Chad Readler, acting assistant attorney general, said the county and San Francisco were interpreting the executive order too broadly. The funding cutoff applies to three Justice Department and Homeland Security Department grants that require complying with a federal law that local governments not block officials from providing people's immigration status, he said.

The order would affect less than $1 million in funding for Santa Clara County and possibly no money for San Francisco, Readler said.

Readler argued the Trump administration was using a “bully pulpit” to "encourage communities and states to comply with the law.”

In his ruling, Orrick sided with San Francisco and Santa Clara, saying the order "by its plain language, attempts to reach all federal grants, not merely the three mentioned at the hearing."

"The rest of the order is broader still, addressing all federal funding," Orrick said. "And if there was doubt about the scope of the order, the president and attorney general have erased it with their public comments."

He said: "Federal funding that bears no meaningful relationship to immigration enforcement cannot be threatened merely because a jurisdiction chooses an immigration enforcement strategy of which the president disapproves."

The judge clarified that the injunction “does not impact the Government’s ability to use lawful means to enforce existing conditions of federal grants … nor does it restrict the Secretary from developing regulations or preparing guidance on designating a jurisdiction as a 'sanctuary jurisdiction.'”

The Trump administration says sanctuary cities allow dangerous criminals back on the street and that the order is needed to keep the country safe. San Francisco and other sanctuary cities say turning local police into immigration officers erodes trust that's needed to get people to report crime.

The order also has led to lawsuits by Seattle; two Massachusetts cities, Lawrence and Chelsea; and a third San Francisco Bay Area government, the city of Richmond. The San Francisco and Santa Clara County suits were the first to get a hearing before a judge.

San Francisco and the county argued in court documents that the president did not have the authority to set conditions on the allocation of federal funds and could not force local officials to enforce federal immigration law.

They also said Trump's order applied to local governments that didn't detain immigrants for possible deportation in response to federal requests, not just those that refused to provide people's immigration status.

The Department of Justice responded that the city and county's lawsuits were premature because decisions about withholding funds and what local governments qualified as sanctuary cities had yet to be made.

The sanctuary city order was among a flurry of immigration measures Trump has signed since taking office in January, including a ban on travelers from several Muslim-majority countries.

A federal appeals court blocked the original travel ban. The administration then revised it, but the new version also is stalled in court.

Fox News' Bill Mears and The Associated Press contributed to this report.