Washington, D.C., officials warned that the nation’s capital could lose millions — or even billions — in federal assistance annually after President Donald Trump signed a vaguely worded order to crack down on communities that resist the deportation of undocumented immigrants. And Chicago’s mayor vowed to continue welcoming immigrants.

Speaking Wednesday at the Department of Homeland Security, Trump singled out sanctuary cities, such as Washington, Chicago and Los Angeles, as causing “immeasurable harm” to national security by refusing to help the federal government identify and deport undocumented residents. Trump directed Homeland Security to examine ways to limit “federal funds, except as mandated by law” to sanctuary cities — wording that puzzled elected officials and municipal attorneys across the country.

Budget officials in Washington said the use of the word “funds” could include a wide range of federal assistance to the city, including even $2.5 billion in annual Medicaid contributions — or roughly 20 percent of the city’s total annual spending.

Trump’s executive order sent a shock through city halls and county government buildings across the country.

“This is a federal issue, and the administration should not be dumping it on the cities,” said D.C. Council Chairman Phil Mendelson, who added he was worried by the initial assessment of city budget officials. “I find it offensive that the people who can’t fix the federal immigration policy are trying to put the onus for enforcement on local authorities,” he said, declining to speculate about how the city would fight the order.

Chicago Mayor Rahm Emanuel vowed not to bend. “We’re going to stay a sanctuary city,” Emanuel told reporters Wednesday. “We welcome people, whether you’re from Poland or Pakistan, whether you’re from Ireland or India or Israel, and whether you’re from Mexico or Moldova, where my grandfather came from, you are welcome in Chicago as you pursue the American dream.”

In San Francisco, Mayor Ed Lee expressed a mix of defiance and confusion about the specific threat his city faced. “We receive about $1 billion in federal monies,” Lee told reporters. “But I’m not sure at all, and neither is the city attorney, about the language they used and what’s under review at this time.”

Boston Mayor Marty Walsh promised outright defiance, saying he would use all city resources to protect the city’s undocumented immigrants “even if that means using City Hall itself as a last resort.”

During a news conference Wednesday night, D.C. Mayor Muriel Bowser said the District would remain a sanctuary city, even as she said the impact to the city remained entirely unclear.

“Our city and our values did not change on Election Day,” Bowser said. “Being a sanctuary city means we are not an agent of the federal government . ... It means that our police can focus on serving D.C. residents — protecting and serving them — no matter their immigration status.”

Washington is among many heavily Democratic cities that have embraced the sanctuary label, but one of the few in the region. Other communities, including Montgomery County, Maryland, and Baltimore, walked a careful line Wednesday, seeming not to classify themselves as strictly sanctuary jurisdictions, even as they are widely considered such.

The definition of “sanctuary” varies significantly from place to place. Some cities and counties merely refuse detainer requests — which occur when the federal government asks a local community to hold an undocumented immigrant already in its custody until federal officials can start deportation proceedings. Other communities instruct their local police not to ask about immigration status. And still others issue identification cards and driver’s licenses to undocumented immigrants and provide other services. The District and Chicago recently created legal-defense funds for undocumented immigrants.