Federal immigration agents arrested 50 people in Massachusetts this week in what they called targeted raids in “sanctuary cities” and surrounding regions, including in Boston, where police say they were involved in a “limited capacity.”

Of the 50 arrested in Massachusetts, 20 were picked up on non-criminal charges, according to Immigration and Customs Enforcement, which ran the so-called “Operation Safe City” in cities across the country, scooping up 500 people in total.

ICE officials say they did not target those protected under the Deferred Action for Childhood Arrivals program, or DACA, and instead homed in on adults who knowingly violated U.S. immigration laws, as well as those with criminal convictions, charges or “known” gang affiliations.

Thomas Homan, ICE’s acting director, directly criticized “sanctuary cities” in a statement, saying their politics are shielding “criminal aliens.”

“As a result, ICE is forced to dedicate more resources to conduct at-large arrests in these communities,” he said.

ICE detailed just four of the Massachusetts arrests, including one in Boston of a “citizen of India who entered the U.S. illegally” and was once convicted of indecent assault and battery on a person over 14 years old and required to register as a sex offender.

In Lynn, agents detained a Lynn resident from El Salvador with a record of assault with a dangerous weapon convictions; in Brockton, a Honduran with an assault conviction; and in Woburn, a Guatemalan who officials say had lawful permanent resident status but had been convicted of assaulting a child under 14.

An ICE spokesman declined to release information on other arrests or where they took place.

Federal officials earlier this year labeled Boston, as well as four other communities, as having policies that “limit cooperation” with ICE. Mayor Martin J. Walsh has repeatedly pushed back on President Trump’s immigration policies.

Police spokesman Lt. Michael McCarthy said the Boston Police Department’s ICE liaison “was involved in a limited capacity … to assist with any Boston incidents.” In February, Police Commissioner William B. Evans said the BPD would turn over violent felons but otherwise not take part in ICE raids.

McCarthy said the operation was not a “civil detainer issue.”

“This was a criminal operation,” he said. “So our involvement was in keeping with exactly what the commissioner stated in February.”