ICE agents have detained more than 50 illegal immigrants in raids in the last two days targeting suspected drug dealers — many of whom had been freed by local judges or jails, the Herald has learned.

The busts were carried out in East Boston, Dorchester, Lawrence, the Worcester area, Rhode Island, New Hampshire and Connecticut, according to a law enforcement official who told the Herald the focus of the operation was combating the region’s deadly opiate epidemic.

The detainees include three illegal immigrants from Brazil who are wanted there for murder, the official said.

“The target was fentanyl, heroin and cocaine dealers and the illegal immigrants doing it,” the law enforcement official said, adding details of the sweep are due to be made public Thursday.

Boston-based Immigration and Customs Enforcement teams joined others from all over New England in a continuation of this fall’s Operation Law and Order. The earlier sweep netted 50 suspected illegal immigrant drug dealers and resulted in the seizure of enough fentanyl to “kill half the state,” one top official said at the time.

This week’s raids included some with drug convictions or pending drug cases, the official said, with many eligible for deportation. The official said that in many of the cases, the illegal immigrant drug suspects had been allowed to go free by local judges and jails despite active ICE detainers.

Resistance to immigration law has become increasingly widespread in Massachusetts and other parts of the country in reaction to the Trump administration. The so-called “sanctuary city” movement — where police are directed by mayors to not cooperate with ICE — has been spreading to courts, with reports of judges aiding illegal immigrants suspected of crimes in evading ICE agents waiting with detention orders.

“Sanctuary policies in Massachusetts are contributing directly to the opiate epidemic by returning the very criminals who are peddling back to the streets to deal,” said Jessica Vaughan of the Center for Immigration Studies. “They could have been sent back to their home countries instead of back to our neighborhoods to keep distributing death.”

ICE officials said in the fall, sanctuary cities need to see the bigger picture — taking down drug dealers.

Boston, Cambridge, Somerville, Lawrence, Newton, Northampton and Amherst are all considered sanctuary cities where immigration detainers have been ignored. Boston’s Trust Act — a de facto sanctuary city policy — forbids police from participating in immigration busts unless ICE has a criminal warrant.

U.S. Attorney Andrew E. Lelling in Boston said this fall, federal agents will continue to target drug traffickers.

“Lawrence is a clearing house for illegal drugs pouring into New Hampshire and Maine via (interstates) 93 and 495,” Lelling said last year. “The top priority … is reducing the number of deaths attributed to overdoses.”

The state’s opioid crisis is responsible for more than 1,500 deaths through the first nine months of this year — most linked to the deadly synthetic opioid fentanyl.

UPDATE: Today the head of the Boston-area ICE office said the threat is all too real:

“ICE Boston stands committed to work with local and state law enforcement and respects the rulings and sovereignty of the Massachusetts Supreme Court. While some within the criminal justice system seem not to grasp the threat when criminal aliens are released back to the street, the men and women of ICE, through efforts like the one we have completed this week, remain committed to apprehending those dangerous criminal aliens who threaten our communities. The mission of ICE Boston will always be to protect the people of the Commonwealth and New England,” Todd M. Lyons, Acting Field Office Director, ICE Enforcement and Removal Operations, Boston