Mayors of major cities with large immigrant populations are openly saying they will resist President Trump's efforts to stop them from protecting illegal immigrants.

Trump signed an executive order this week that would strip funding from so-called "sanctuary cities," which are cities or other jurisdictions that refuse to cooperate with U.S. Immigration and Custom Enforcement requests to detain or turn over a person who violate U.S. immigration laws.

Mayors in some of those cities, like Boston, Chicago, Denver, Los Angeles, Miami, Seattle and Washington, D.C., say they won't comply, setting up a showdown that could end up with some of them getting less federal funding from the Trump administration. In a statement last week, Boston Mayor Marty Walsh said he was "deeply disturbed" by Trump's executive order.

"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, adding that 28 percent of Boston's residents are immigrants.

In 2014, Boston City Council directed local law enforcement not to detain individuals based on immigration status unless there is a criminal warrant. In Massachusetts, there are an estimated 210,000 undocumented immigrants.

Washington, D.C. Mayor Muriel Bowser said her city will remain a sanctuary city, a label the District has embraced.

"Our city and our values did not change on Election Day," Bowser said at a press conference after Trump's order was released. "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."

Bowser's communications director told the Washington Examiner that the District "does not intend to change our immigration policies and will continue to serve as a sanctuary city."

"The Bowser administration continues to monitor and assess what the potential impacts would be on government operations were these extreme policies to take effect. Our goal is to be in the best position possible to protect our values, but many provisions from President Trump's executive order remain vague and ambiguous," said Kevin Harris. "As more of those details come to light, the administration will work with our agency directors and city attorneys on potential responses, either to mitigate the impact on District families or pursue legal challenges to provisions we feel are not legally sound."

The District said it could continue to use taxpayer funds to support defense funds for illegal immigrants, steps Chicago, Los Angeles, San Francisco and New York have also taken. In December, Chicago Mayor Rahm Emanuel said the city would remain a sanctuary city despite Trump winning the election, and pledged $1 million to such public-private defense funds.

Some legal experts say the leaders of these cities may be on safe legal ground. According to Peter Markowitz, a professor at New York's Cardozo School of Law who focuses on immigration, the federal government will have many hurdles to jump to slash funds.

"The Constitution grants Congress, not the president, the power to determine how federal monies are spent," Markowitz told the Washington Examiner. "Moreover the Supreme Court has recently made clear that the Constitution prohibits the federal government from using the threat of defunding to coerce localities and states into federal service."

Markowitz predicts that any attempt by the "Trump administration to withhold funds from sanctuary jurisdictions will most certainly be met by robust legal challenges." Randy Capps directs research for U.S. programs at the Migration Policy Institute, and told the Washington Examiner he foresees a "long term legal battle in the courts" when Trump goes through with plans to slash funding to sanctuary cities.

"The definition of a sanctuary city is not clear," Capps said. He said it will be up to the next attorney general, likely Sen. Jeff Sessions, to decide. Then, Trump's executive order "depends on how broad the definition is" when it comes time to enforce.

And groups are ready when that time comes. According to Kemi Bello at the Immigration Legal Resource Center, jurisdictions have told the group that they stand by the legality of their immigration policies and are prepared to defend them.

The group, which trains advocates, organizations and law professionals on immigration policy and law, is ready to push back and protect the leaders of sanctuary cities.

"The president's move to compel local communities to carry out the work of federal authorities stands on questionable legal ground, and it violates the principles of local control. We will do everything in our power to safeguard the legal rights of local elected officials to govern their communities with autonomy and regard to their own local values and priorities," said Lena Graber, Special Projects Attorney at the ILRC, in a statement.