This article is copublished with ProPublica, the nonprofit investigative newsroom.

Just days after he took office in 2017, President Trump set out to make good on his campaign pledge to halt illegal immigration. In a pair of executive orders, he ordered “all legally available resources” to be shifted to border detention facilities, and called for hiring 10,000 new immigration officers.

The logistical challenges were daunting, but as luck would have it, Immigration and Customs Enforcement already had a partner on its payroll: McKinsey & Company, an international consulting firm brought on under the Obama administration to help engineer an “organizational transformation” in the ICE division charged with deporting migrants who are in the United States unlawfully.

ICE quickly redirected McKinsey toward helping the agency figure out how to execute the White House’s clampdown on illegal immigration.

But the money-saving recommendations the consultants came up with made some career ICE workers uncomfortable. They proposed cuts in spending on food for migrants, as well as on medical care and supervision of detainees, according to interviews with people who worked on the project for both ICE and McKinsey and 1,500 pages of documents obtained from the agency after ProPublica filed a lawsuit under the Freedom of Information Act.