The Obama administration this week issued a new policy limiting the use of solitary confinement in federal immigration detention centers.

The move follows intense criticism of the practice. And it comes amid a national debate on overhauling the nation’s immigration system.

Critics object to isolating people who are being detained for immigration violations, which are civil offenses. They also worry about the psychological harm solitary confinement may do to detainees.

But advocates for stricter immigration enforcement pointed out that many people held in immigration detention centers have been convicted of serious crimes and may be connected to violent gangs. They said federal immigration authorities must have the option to segregate detainees so they can keep their detention centers safe.

Issued Wednesday, the new U.S. Immigration and Customs Enforcement directive says solitary confinement should be used “only as a last resort” for people with special vulnerabilities, including mentally ill people, the elderly and pregnant or nursing women. It also mandates new reporting requirements and oversight.