Boston Mayor Martin J. Walsh called the president’s executive orders “a direct attack on Boston’s people” and even offered to shelter immigrants in City Hall.

Trump’s action fulfilled a major campaign promise that he said is aimed at improving public safety, but leaders in the cities and towns he is targeting quickly promised to shield immigrants.

President Donald Trump on Wednesday issued executive orders to build a wall at the Mexican border, crack down on undocumented immigrants, and strip federal funding from the sanctuary cities that protect them, including Boston, Somerville, and Lawrence.

“We will not be intimidated by the threat to federal funding. We have each other’s backs and we have the constitution of the United States of America on our side,” said Walsh, flanked by co-workers he said were immigrants and their children.


He said 28 percent of Boston’s residents are immigrants, and nearly half the public school students, like Walsh, are the children of immigrants.

Nationwide, there are an estimated 11 million undocumented immigrants, including 210,000 in Massachusetts.

“I want to say directly to anyone who feels threatened today or vulnerable: You are safe in Boston,” Walsh added.

In his orders, Trump also pledged to build a wall on the US-Mexico border and to deny visas to countries that refuse to take back people the United States wants to deport.

He also created an office to help victims of crimes committed by deportable immigrants.

Attorney General Maura Healey criticized the sanctuary city order and said her office would “stand with our cities and towns in the coming days.”

A spokeswoman for Governor Charlie Baker said he supports “comprehensive legislation’’ to repair the immigration system, but added that “diverting billions of dollars in taxpayers funds away from other important priorities, like health care and infrastructure, to build a wall is not the best way to achieve this goal.’’


Trump insisted from the beginning of his campaign that Mexico would pay for the wall, but Mexican leaders have balked. Trump has said the project, which analysts estimated could cost up to $20 billion, will be started with US tax dollars, so construction can begin quickly.

Mark Krikorian, executive director of the Center for Immigration Studies, which favors tougher enforcement, called Trump’s actions “a very important, positive step.” But, he added, “There’s a lot of follow-through” to hire extra border patrol and immigration agents.

The call for expanded enforcement sent a shudder of fear across Massachusetts among immigrants and advocates. Eva Millona, executive director of the Massachusetts Immigrant and Refugee Advocacy Coalition, called it “open season” on immigrants. “It’s ending the tradition of a country of immigrants,’’ she said.

Under former President Barack Obama, serious criminals and recent border-crossers were priorities for deportation.

Trump said he also will prioritize those groups, but made clear that a wider group of people could be targeted for deportation. His executive order on immigration enforcement allows agents to deport people with outstanding deportation orders, immigrants who are deemed public safety threats, and immigrants arrested but not convicted of any crime.

Trump unveiled the new policies to applause at the Department of Homeland Security, where he swore in Brighton native and retired general John Kelly as secretary, and spoke to a crowd of federal agents.

“This is a law enforcement agency. But for too long your officers and agents haven’t been allowed to properly do their jobs,” Trump said of Immigration and Customs Enforcement and the Border Patrol. “That’s all about to change.”


Trump also took aim at sanctuary cities and other jurisdictions that refuse to cooperate with immigration officials. He authorized federal officials to bar such cities, towns, and agencies from receiving federal grants, except for law enforcement purposes.

No official definition of a sanctuary city exists, but in general, such cities don’t allow their police to help ICE detain and deport immigrants.

The Center for Immigration Studies, which opposes illegal immigration, estimates there are more than 200 sanctuaries nationwide, including Amherst, Cambridge, Hampden County, Holyoke, Lawrence, Northampton, Somerville, and Springfield in Massachusetts. Chelsea also calls itself a sanctuary city. Springfield has disputed its status.

Federal officials have urged cities and towns to help them detain illegal immigrants, particularly criminals.

In general, the process works like this: Local police arrest someone for a crime, book and fingerprint them, and the fingerprints are sent to the FBI and ICE. If immigration officials want to deport that person, the police will keep them in a holding cell, even after a judge has granted them bail, usually for up to 48 hours so that immigration agents can pick them up. ICE officials say they often do not have enough personnel to pick up immigrants immediately.

Policies vary, but generally, sanctuary cities refuse to hold these immigrants after a judge or clerk-magistrate has ordered them released on bail, arguing that it is unconstitutional to detain someone for a civil immigration violation after a judge has ordered them released.


Officials in sanctuary cities and towns say they fear that if police cooperate with ICE, immigrants will be afraid to report crimes or help them solve homicides and other cases.

Though federal dollars are often a small percentage of their budgets, city leaders say they fund vital items such as job-training programs in Holyoke, home repairs for the elderly in Northampton, drug treatment in Somerville, and fuel aid in Cambridge.

Lawrence Mayor Daniel Rivera, a war veteran who did not support becoming a sanctuary city but was overruled by the City Council, blasted Trump’s actions as unnecessary. He said Trump should create a path to citizenship for the otherwise law-abiding undocumented immigrants Trump called “terrific people” instead of frightening immigrant communities.

“Shame on him,” Rivera said. “This is going to be the most un-American thing we’ve seen in generations.”

In Somerville, Mayor Joseph Curtatone said his city risks losing at least $6 million in direct federal aid, but that officials would tighten their belts and defend their neighbors.

“We’re going to stand with our neighbors, the children who go to school with our kids, our colleagues in this community, the people who love this country,” he said.

But Trump excoriated cities and towns for allegedly protecting serious criminals from deportation. In Boston and Lawrence, for instance, police are not allowed to detain immigrants for federal immigration officials unless they have a criminal warrant — which frustrates immigration agents because deportation cases are rarely criminal. Most are civil violations of immigration law.


Travis Andersen contributed to this report. Material from The Washington Post was used in this report. Maria Sacchetti

can be reached at maria.sacchetti@globe.com.