The Biden administration has decided to stop detaining immigrants in a pair of county jails facing federal probes in Georgia and Massachusetts, calling the decision an “important first step” in a broader review of the nation’s sprawling network of immigration jails.

DHS Secretary Alejandro Mayorkas on Thursday ordered U.S. Immigration and Customs Enforcement to immediately terminate its contract with the Bristol County Sheriff’s Office in Massachusetts and to transfer the few remaining detainees elsewhere. He also directed ICE to rescind an agreement with the sheriff’s office that trained deputies to screen inmates arrested for crimes to see if they are also eligible for deportation.

Mayorkas also directed ICE to “as soon as possible” sever its contracts with the Irwin County Detention Center in rural Georgia, a more complicated endeavor because the facility is county-owned but run by a private contractor.

Federal officials chose the two facilities mainly because their detention rosters have shrunk and they are “no longer operationally necessary,” said a Department of Homeland Security official who spoke on the condition of anonymity to discuss the administration’s deliberations. Bristol is holding seven detainees out of nearly 200 beds; Irwin has 114 detainees out of almost 1,000 beds.

Both county jails are also under federal investigation for complaints of abuses against immigrants — allegations that remain open and unresolved — and those factored into Mayorkas’s decision, the official said.

In a memo to ICE directing the changes, Mayorkas said his “foundational principle” is that “we will not tolerate the mistreatment of individuals in civil immigration detention or substandard conditions of detention.”

“We have an obligation to make lasting improvements to our civil immigration detention system,” Mayorkas said in a statement. “This marks an important first step to realizing that goal. DHS detention facilities and the treatment of individuals in those facilities will be held to our health and safety standards. Where we discover they fall short, we will continue to take action as we are doing today.”

Bristol County Sheriff Thomas Hodgson — an outspoken Trump supporter who once offered to dispatch jail inmates to build the wall on the U.S.-Mexico border — called the move a “political hit job” and said it could harm public safety by leaving fewer officers to comb through the jail’s criminal roster for people to deport.

“Shame on Department of Homeland Security Sec. Alejandro Mayorkas for putting his left-wing political agenda above public safety by ending the Bristol County Sheriff’s Office contracts with Immigration and Customs Enforcement,” he said in a statement. “While Sec. Mayorkas and the Biden administration are turning their backs on the people of our great country, I will not.”

Irwin officials and LaSalle Corrections, the company that runs the Georgia jail, did not respond to requests for comment.

DHS said the moves are part of the Biden administration’s broader plan to overhaul the nation’s network of more than 200 county jails and detention centers housing civil immigration detainees in deportation proceedings. More changes could come as Mayorkas conducts a sweeping review of detention facilities in the coming weeks.

President Biden has pledged to end for-profit immigration detention and reverse President Donald Trump’s push to detain as many immigrants as possible. He warned Congress last week that it is “long past time” for lawmakers to pass a bill that would allow millions of undocumented immigrants to apply for U.S. citizenship.

And his changes are having measurable impacts: Immigration arrests in the interior of the United States have plunged by more than half, records show. Jails that were holding more than 50,000 detainees a day under Trump are detaining approximately 20,000.

Advocates for immigrants and Democratic lawmakers cheered the DHS announcement. Silky Shah, executive director of Detention Watch Network, an advocacy group, called the closings “an important win for the immigrant rights movement.”

“Immigrant lives are in jeopardy anytime they are in ICE custody, and we will continue to press the Biden administration to cut detention contracts, release people from ICE custody, and shut down detention centers for good,” she said in a statement.

The Bristol County Sheriff’s Office came under state and federal investigation a year ago when staff members deployed pepper balls, a stun grenade and canines against immigrant detainees amid a dispute over coronavirus testing. Irwin is facing federal investigations after a former nurse filed a whistleblower complaint alleging that women held at the facility were subjected to unwanted gynecological procedures, including hysterectomies.

Mayorkas said in the memo that the Bristol facility southeast of Boston “is of minimal operational significance to the agency” and there is “ample evidence” that conditions there are “unacceptable.”

Massachusetts Attorney General Maura Healey (D) faulted Hodgson and his staff for a May 1, 2020, incident at the jail, and urged DHS to terminate its agreements with Bristol. She said some detainees who had refused to submit to coronavirus testing and isolation, threw plastic chairs at staff members, smashed walls and attempted to barricade the unit with tables, trash bins and appliances.

Healey said she did not condone the detainees’ behavior, but she said the sheriff’s office used “disproportionate” force on detainees after the disturbance had largely subsided. Three detainees had to be taken to the hospital and a fourth had to be revived by chest compressions, but she said he was not taken to the emergency room.

Hogdson has disputed the attorney general’s findings and said the DHS inspector general’s office is investigating.

Bristol also faced a class-action lawsuit last year alleging unsafe conditions during the pandemic. U.S. District Judge William Young, a Ronald Reagan nominee, barred Bristol from accepting new detainees and released dozens. But he also ruled in May 2020 that the jail’s staff had “admirably” taken steps to protect detainees from the coronavirus.

Mayorkas did not detail his reasoning for closing the Irwin County Detention Center in Ocilla, Ga., almost 200 miles south of Atlanta. But he said the agency should relocate staff, release or transfer detainees, and preserve evidence and witnesses needed for ongoing investigations.

The DHS inspector general’s office and the FBI are investigating allegations that surfaced last year when a former nurse at the Irwin facility filed a whistleblower complaint saying that a doctor — later identified as Mahendra Amin — was performing hysterectomies and other unwanted procedures on female detainees. Amin, who declined to comment, has denied wrongdoing, and no charges have been filed.

Mayorkas said in the memo he would schedule a meeting with DHS officials next week to plan to close Irwin and to “discuss my concerns with other federal immigration detention centers” across the United States.

Tae Johnson, the acting ICE director, said that the agency will continue to arrest immigrants who match the new administration’s criteria: people who pose a threat to national security and public safety, or recently crossed the border.

“ICE will continue to ensure it has sufficient detention space to hold noncitizens as appropriate,” Johnson said in a statement Thursday. “Withdrawing from the Bristol agreement, and planning to close the Irwin facility, will not impair or in any way diminish ICE operations.”