We’re familiar with grim stories about black-shirted federal agents barging into apartment complexes, convenience stores and school pickup sites to round up and deport immigrants. We’ve heard far less about the forced labor — some call it slavery — inside detention facilities. But new legal challenges to these practices are succeeding and may stymie the government’s deportation agenda by taking profits out of the detention business.

Yes, detention is a business. In 2010, private prisons and their lenders and investors lobbied Congress to pass a law ordering Immigration and Customs Enforcement to maintain contracts for no fewer than 34,000 beds per night. This means that when detention counts are low, people who would otherwise be released because they pose no danger or flight risk and are likely to win their cases in immigration court remain locked up, at a cost to the government of about $125 a day.

The people detained at these facilities do almost all of the work that keeps them running, outside of guard duty. That includes cooking, serving and cleaning up food, janitorial services, laundry, haircutting, painting, floor buffing and even vehicle maintenance. Most jobs pay $1 a day; some work they are required to do pays nothing.

Workers in immigration custody have suffered injuries and even died. In 2007, Cesar Gonzalez was killed in a facility in Los Angeles County when his jackhammer hit an electrical cable, sending 10,000 volts of direct current through his body. He was on a crew digging holes for posts to extend the camp’s perimeter.