Boston Mayor Martin J. Walsh proposed turning City Hall into a taxpayer-funded hotel for illegal immigrants and vowed to reject federal funds if it meant caving on policies designed to protect the undocumented from deportation.

“If people want to live here, they’ll live here,” Walsh said yesterday. “They can use my office. They can use any office in this building. Any place they want to use. They’ll be able to use this building as a safe space.”

At one point, he chastised a reporter who used the term “illegal immigrant” in a question.

“Undocumented immigrants,” Walsh said. “I’m not sure what an illegal immigrant is.”

Walsh — facing a re-election challenge from City Councilor Tito Jackson, who wants to make Boston a sanctuary city, and trying to distance himself from an ongoing extortion scandal — appears to be courting a public war with President Trump to rally support in a city where 82 percent voted for Hillary Clinton in November.

The mayor’s emergency press conference also overshadowed what would have otherwise been the big City Hall story of the day — the revelation that Walsh sat in on two meetings about the Boston Calling music festival during “the relevant time period” of the U.S. Attorney’s Office’s probe into union strong-arming.

Walsh yesterday also promised the city would reject federal taxpayer dollars if it meant easing protections on illegal immigrants.

“If there’s strings attached to federal money coming out of Washington, D.C., that’s supposed to help our city, and there’s strings attached, then the money’s not worth taking,” Walsh said.

Boston is technically not a sanctuary city, but did pass the Trust Act, which limits law enforcement’s ability to detain illegal immigrants for ICE.

Trump signed two executive orders yesterday to begin constructing a wall across the Mexican border within months and cut off federal funds to sanctuary cities. The actions also direct the Department of Homeland Security to hire 5,000 additional Border Patrol agents and to triple the number of ICE officers.

Today the president is also expected to announce a ban on Syrian refugees and a 120-day suspension of the nation’s broader refugee program.

But Bay State Democrats quickly bashed Trump’s new policies, often using emotional and dramatic rhetoric to make their point.

“Today, Lady Liberty weeps at Donald Trump’s executive actions that fly in the face of our nation’s history as a beacon to those seeking a better life in America,” Massachusetts U.S. Sen. Edward J. Markey said in a statement.

Mayor Joseph A. Curtatone of Somerville — a sanctuary city — stood in front of a poster with a heart-shaped American flag that read “Hate has no home here” and referenced Trump aides who have touted his “big heart.”

“I ask him to open that heart and his mind and to look at these people … as human beings, seeking a better life, like my family did and many of our families did, for themselves and their children,” Curtatone said.

He added that his city would go without certain federal funds, rather than bow to Trump.

“We’re prepared to tighten our belts,” Curtatone said. “What we’re not going to do is react to a Damocles of money hanging over our heads to abandon our democratic, human principles of civility. We’re not going to run away from our fellow man for a bucket of money.”

While Democrats insisted Trump’s proposals would tear apart illegal immigrant families through deportation, the president yesterday read the names of children killed by illegal immigrants over the years.

“These families lost their loved ones,” Trump said. “Then they endured a system that ignored them, while at the same time constantly rewarding those who broke the law. For these families, it’s been one injustice after another. But that all turns around, beginning today.”