The federal government was phasing out private prisons until the Trump administration took office. Why the reversal? Here's everything you need to know:

When did prisons become private?
What is now a $5 billion industry began at the state level. The first private prison opened in Tennessee in 1984, operated by a company known today as CoreCivic. It was the height of the war on drugs, and prison populations were rising too fast for government facilities to keep up — a federal judge actually ordered Tennessee to stop admitting inmates to its prisons, because of egregious overcrowding. Private companies argued that their new construction designs and use of electronic surveillance would let them operate larger prisons with a smaller staff, saving the public money. Today, private prisons incarcerate about 9 percent of all U.S. prisoners, and 19 percent of all federal prisoners. About 75 percent of all immigrants detained by ICE are also in private prisons. Just two companies dominate the industry: CoreCivic has 42 percent of the market and GEO Group 37 percent. GEO Group donated heavily to President Trump's campaign, and both GEO and CoreCivic contributed $250,000 to his inauguration committee.

Are private prisons cheaper?
Studies on the subject tend to hedge on that issue, noting that differences in the public and private facilities make them hard to compare. One study of a single California facility operated by the GEO Group found a saving of 3 percent, while another found 15 percent. But critics say that even when they cost somewhat less in the short term, private prisons warp justice, because the company's responsibility is to its shareholders, not the public. For-profit institutions have no incentive to rehabilitate their prisoners, but every incentive to keep recidivism rates high so they can get future contracts. The more people imprisoned, the higher the profits. In 2016, the Obama administration announced that the use of private prisons at the federal level would be phased out. Crime was down, prison populations were falling, and private prisons had higher rates of violence and inhumane treatment.

Why would they be less safe?
Private prisons save money by hiring fewer guards, paying them less, and giving them less training, as well as by providing fewer educational, medical, and enrichment services to inmates. The result is less control of the inmates and more violence. A scathing 2016 report by the Justice Department's Office of the Inspector General found that federally contracted private prisons had more security violations per inmate than public prisons, including a 28 percent higher rate of inmate-on-inmate assaults and more than twice as many inmate-on-staff assaults. In an attempt to regain control, private facilities threw more inmates in solitary and used prison-wide lockdowns more frequently.

Why was the order reversed?
With the federal prison population expected to fall under sentencing-reform policies supported by both Democrats and Republicans until 2016, the need for private prisons was reduced. But Attorney General Jeff Sessions swept into office on a pledge to lock up more people by reinstating mandatory minimum sentences for drug possession and other low-level offenses. "We are returning to the enforcement of the laws as passed by Congress, plain and simple," Sessions said. He said phasing out the use of private prisons "impaired the bureau's ability to meet the future needs of the federal correctional system." The Trump administration's crackdown on unauthorized immigration also played a major role in the decision.

How so?
Most people who are caught crossing the border illegally are detained and deported, but the law requires special protections for families, minors crossing alone, and those who request political asylum. The Obama administration policy was to "catch and release" most people stopped at the border; while the majority showed up for their immigration hearings, many did not. Trump had campaigned on "zero tolerance" for illegal immigration, so his Justice Department began prosecuting every person who entered the country illegally. That required the building of more facilities to hold them all, which created a boom for the private prison industry. A month after Trump's inauguration, CoreCivic and GEO Group stocks shot up by 137 percent and 98 percent, respectively. Some 400,000 immigrants are now detained for at least a short time every year.

How much does that cost?
The old system of giving migrants alternatives to detention (such as ankle bracelets, the equivalent of parole officers, or just a pledge to show up) cost just $4 a day, while housing them temporarily in local jails cost about $100. ICE pays private companies at the border $159 per inmate per day, including for detained children. Because subcontractors don't have to follow the same transparency rules as government agencies, it's unclear exactly what services the inmates are getting for that price. Now that Trump has reversed his family-separation policy, the administration is seeking to house families at private facilities at the border indefinitely. In light of that policy, CoreCivic CEO Damon Hininger recently raved at an investors' conference about the company's financial prospects. This is "the most robust kind of sales environment we've seen in probably 10 years," he said.

A lack of oversight
CoreCivic, formerly known as Corrections Corporation of America, has been cited numerous times for abuses in its prisons. In 2010, the Kentucky governor ordered more than 400 female prisoners removed from a CCA prison after learning inmates were being denied medication and were sexually abused by guards. After an AP investigation in 2013 found that guards in Idaho's largest prison were listed as working 48-hour shifts, CCA admitted it had understaffed the prison by thousands of hours in violation of the state contract; one prisoner had his head stomped, suffering permanent disability, after guards failed to stop a fight. In 2012, minors were abused at a GEO Group juvenile facility in Mississippi that a judge described as a "cesspool of unconstitutional and inhuman acts and conditions." Given the lack of public oversight of private prisons, said Lauren-Brooke Eisen of NYU's Brennan Center for Justice, "it is impossible to know what other injustices are being done."