ACAYUCAN, Mexico — Migrants have been held in a wrestling arena, at a fairground and in government offices. They’ve been forced to sleep in hallways, on an outdoor basketball court, even directly on the hard ground.

Mexico’s detention centers have at times reached triple, quadruple and even quintuple their capacity. Detainees at some centers have endured extreme heat, bedbug infestations, overflowing toilets, days without showers, and shortages of food and decent health care.

President Andrés Manuel López Obrador campaigned for the presidency last year on promises that his migration policy would break from his predecessors’ emphasis on enforcement and focus instead on respecting migrants’ human rights and treating them with dignity. But under threat from the Trump administration, he has reversed course and overseen a sharp increase in migrant detentions and deportations.

[Read: Detentions of Child Migrants at the U.S. Border Has Surged to Record Levels]

This iron-fisted approach has helped lower the number of migrants trying to cross the southwest border of the United States. But it has also resulted in a crisis in Mexico’s detention centers that, critics say, is subjecting adults and children to inhumane conditions, exposing the Mexican government’s lack of preparedness and serving as a glaring rebuke of Mr. López Obrador.