In the face of President Donald Trump’s pledge to carry out mass deportations, Bay Area officials are planning to sue his administration to halt orders that would punish state and local governments that have declared themselves “sanctuaries” for immigrants living in the country illegally.

Santa Clara County and San Francisco announced Friday they are leading a national coalition of local governments in suing the administration’s threats to withhold billions of dollars in federal funding from sanctuary jurisdictions and prosecute local officials who refuse to assist federal immigration agencies.

Santa Clara County estimated that it received more than $3 billion in federal funds this fiscal year to pay for health care, education, infrastructure and other essential services.

“Our job is not to enforce immigration laws, and the Constitution could not be more clear that the federal government can’t require us to help with enforcement of civil immigration laws,” Santa Clara County Counsel Tony LoPresti said at a news conference Friday.

Trump contends that efforts to limit local coordination on immigration shield violent criminals from deportation, although studies have found immigrants living in the country without authorization are not more likely to commit crimes than the general population. Santa Clara County and San Francisco contend that immigration enforcement is a federal responsibility, and using local law enforcement for immigration erodes community trust and distracts from a focus on local issues.

“This is the federal government coercing local officials to bend to their will,” San Francisco City Attorney David Chiu said at the news conference.

Some Bay Area Republicans criticized the lawsuit, describing it as both a publicity stunt and an attempt to preserve “federal handouts” by local governments struggling to balance their budgets.

“Chiu wants money flowing into city hall’s unaccountable programs and departments,” Richard Greenberg, a San Francisco-based Republican political activist, wrote on the social media platform X.

During Trump’s first term, California passed a sanctuary law that prohibits local law enforcement statewide from assisting in immigration raids or handing over people booked into county jails to federal immigration authorities, among other restrictions. Cities and counties across the Bay Area, including Alameda County, Oakland and Berkeley, also adopted or reaffirmed local sanctuary ordinances.

In 2017, during the first Trump administration, the federal government sought to freeze funding to sanctuary cities, but local governments, including Santa Clara County, successfully sued to stop the order. The case did not reach the U.S. Supreme Court.

This time around, the administration is going even further, threatening to criminally charge state and local officials and ordering a new funding pause, even as a court last week blocked a widespread federal spending freeze. Trump’s Jan. 20 executive order — titled “Protecting the American People Against Invasion” — mandated the funding cuts to sanctuary jurisdictions, and subsequent Department of Justice memos directed staff to begin investigating state and local officials.

Officials on Friday said they did not believe any federal funding had yet been paused as a result of the immigration order, though Santa Clara County has reported past issues with receiving reimbursements from the federal government. California Attorney General Rob Bonta on Friday announced the state had submitted a legal filing accusing the Trump administration of withholding funding in violation of a court order.

Also on Friday, Republican U.S. House Speaker Mike Johnson reiterated his demand that any federal disaster aid approved by Congress for wildfire victims in Southern California be conditioned on state policy changes aimed at preventing future blazes.

Johnson’s comments followed a lawsuit filed Thursday by the Department of Justice targeting Chicago and Illinois over their sanctuary policies, raising concerns that California officials could be next.

Local officials said that threat in part inspired their lawsuit against the federal government. Santa Clara County Executive James Williams, noting the county’s success in blocking Trump’s previous immigration order, said he is confident the county and San Francisco will prevail once again. “This is the next chapter of the same playbook that was used eight years ago,” he said.

Portland, Oregon, New Haven, Connecticut, and King County, Washington, have also signed on to the lawsuit, which was set to be filed on Friday in the U.S. District Court for the Northern District of California.

It would be the second legal action that both Santa Clara County and San Francisco have taken against the federal government since Trump took office last month. San Francisco signed on to a lawsuit with California and more than 20 other states on Inauguration Day to block an executive order ending birthright citizenship. Santa Clara County filed its own lawsuit over the issue last week, emphasizing the impact the order would have as the county has the largest proportion of immigrants among California’s 58 counties — more than 40% of county residents were born outside of the country.

“Our region and country were built on the backs of immigrants, and we must have courage to continue standing strong,” Santa Clara County Supervisor Sylvia Arenas said in a statement. “We will remain united and stand up for justice, if that means noncooperation with mass deportations that aim to separate our families.”