Within days of taking office, President Donald Trump signed an executive order threatening to stop aid to communities that don’t fully cooperate with federal officials to help deport immigrants. Many mayors of these so-called sanctuary cities were outraged and vowed to continue resisting Trump’s immigration agenda.

Although a federal judge blocked Trump’s plan, these localities still face possible loss of some federal funds as well as reprisals from conservative legislators. Now the conflict between Trump and the mayors has escalated from a war of words to a war of tactics as some “sanctuary cities” — and one state — are taking action to help immigrants avoid Trump’s dragnet. Here are several examples:

Denver

In May, the city passed municipal sentencing reform that could help immigrants avoid deportation for petty offenses. Federal rules put immigrants on Immigration and Customs Enforcement radar when they are convicted of certain types of crimes that carry a sentence of at least a year. Prior to Denver’s reform measure, all criminal violations of city ordinance carried the same penalty — up to 365 days. The new sentencing guidelines place the penalty for low-level violations under 364 days, which could help keep some immigrants off the federal books. “Denver is committed to taking actions that will protect our people’s rights and keep our city safe, welcoming and open,” Mayor Michael Hancock said in a statement after signing the law.

Los Angeles

Los Angeles has an estimated 1.5 million undocumented immigrants, the most in any U.S. city. And the Los Angeles Police Department has a 40-year history of not enforcing immigration law, dating back to former Republican Gov. Pete Wilson’s crackdown on the undocumented. It doesn’t appear that Trump’s aggressive deportation strategy is changing L.A.’s stance. Mayor Eric Garcetti has declared he will sue the federal government for any withholding of funds or pressure placed on the L.A.P.D. to enforce immigration laws. He also set up a $10 million legal defense fund for people threatened with deportation. “This is a city that not only provides sanctuary,” Garcetti said at a recent press conference. “We are a place that will go further and defend our immigrants.”

California

The state Senate passed a bill in late March that officially would make California a sanctuary state. A defiant response to Trump’s threat to defund “sanctuary cities,” the legislation bars state and local law enforcement from using resources to help with immigration enforcement and prohibits law enforcement statewide from asking for immigration status. Connecticut, Colorado, New Mexico and Rhode Island already have similar statewide protections for undocumented immigrants, but this measure, expected to be signed by the governor, is the most far-reaching.

Santa Fe, N.M.

In late February 2017, the Santa Fe City Council passed a resolution reaffirming the city’s status as a welcoming community for immigrants and refugees and adopting several new policies. Among the changes: City employees are now prohibited from disclosing sensitive information, including immigration status, about any person except as required by law. Also, city employees have been directed to refuse access to non-public areas of city property by federal immigration agents who don’t have a warrant. Councilor Joseph Maestas said the measure was a way of "thumbing our nose at" the Trump administration.

Portland, Ore.

In May, in a partially symbolic move, the city council declared Portland a “sanctuary city,” boldly stating its unwillingness to help ICE find and deport immigrants. The city is also providing resources to train staff on how to respond to federal immigration officials who request information on city employees or Portland residents. "The City of Portland will remain a welcoming, safe place for all people,” Mayor Ted Wheeler wrote in a newspaper column.

Washington, D.C.

In response to the Trump administration’s threat to withhold federal funding, Mayor Muriel Bowser said the District would continue to limit cooperation with deportation orders. "I will not let the residents of D.C. live in fear," she said. The City Council also unanimously passed a resolution vowing to maintain “sanctuary city” status. Meanwhile, Attorney General of the District of Columbia Karl Racine, an immigrant who fled political oppression in Haiti, said his office would protect the rights of all District residents, including undocumented immigrants.

Chicago

Like several other big city mayors, Mayor Rahm Emanuel has declared that Chicago will remain a safe haven for undocumented immigrants. In December, even before Trump took office, he pledged $1 million of city funds to assist immigrant families. On Trump’s vow to withhold federal funding from “sanctuary cities,” Emanuel said, “The United States government cannot coerce the city, cannot blackmail the city, cannot punish the city into changing its value system.”

Milwaukee

In early February, the Milwaukee County Board of Supervisors declared the jurisdiction a sanctuary for immigrants and assured that no county money would be used to enforce federal immigration laws. “Some of the values and ideals that have been attacked by President Trump, we’ve now stood up against, and we’ve gone on record,” said County Supervisor Marina Dimitrijevic.

New York City

In late January, Mayor Bill de Blasio announced he was socking away an additional $250 million a year in reserves for four years because of a "huge amount of uncertainty" stemming from Trump’s threat to cut federal funds to “sanctuary cities” like New York, which is home to an estimated undocumented population of over 750,000. “The stroke of a pen in Washington does not change the people of New York City or our values,” de Blasio said.

Boston

In January, Mayor Martin Walsh vowed he would physically protect and harbor undocumented immigrants if necessary. "I will use all of my power within lawful means to protect all Boston residents — even if that means using City Hall itself as a last resort,” he said. “If you don’t agree with me, there’s an election in November.”