BOSTON — Boston Mayor Marty Walsh said if necessary he'll use City Hall to shelter residents who feel threatened by actions announced by President Donald Trump targeting so-called "sanctuary cities."

The Democrat said the city won't retreat from policies supporting immigrants. During a City Hall press conference on Wednesday, Walsh spoke directly to immigrants who he said might feel unjustly targeted, saying "you are safe in Boston."

"We will do everything lawful in our power to protect you. If necessary, we will use City Hall itself to shelter and protect anyone who's targeted unjustly." Walsh said.

"If the people want to live here, they'll live here. They can use my office, they can use any office in this building," Walsh added when pressed by reporters. "Any place they want to use, they'll be able to use in this building as safe place."

Walsh's comments came after White House spokesman Sean Spicer said the Trump administration would strip federal grants "from the sanctuary states and cities that harbor illegal immigrants."

Trump signed an executive order that referred to withholding Justice Department and Homeland Security funds from only those jurisdictions that bar local officials from communicating with federal authorities about someone's immigration status.

Walsh was among many Democratic officials in Massachusetts who sharply criticized Trump on Wednesday.

Somerville Mayor Joseph Curtatone said his city has been a sanctuary city since 1987 and will remain a sanctuary city.

He said that while Somerville will cooperate with federal officials if someone in the country illegally commits a serious crime or felony, they won't have police run immigration checks on everyone who runs a red light or commits a minor offense.

"These are our neighbors. Their kids go to school with our kids. They're our friends. There are colleagues and we're not going to treat them like suspects at every turn," Curtatone said Wednesday.

Cambridge Mayor Denise Simmons said the city just reaffirmed in November that it would remain a sanctuary city.

"We're not going to turn back or turn the page on what and who we have been or want to be, which is a safe harbor for those that choose Cambridge to be where they want to reside as they find this pathway to citizenship," Simmons said.

Other Democrats echoed the criticism.

Attorney General Maura Healey called Trump's executive order an "irresponsible attempt to coerce our communities into conducting his mass deportations." U.S. Sen. Edward Markey described Trump's immigration actions as "un-American."

"None of President Trump's actions today will make us safer," U.S. Sen. Elizabeth Warren said. "They will tear apart the fabric that makes us strong and united as a country."