ProPublica is a nonprofit newsroom that investigates abuses of power. Sign up to receive our biggest stories as soon as they’re published. This article is co-published with The New York Times.

Just days after he took office in 2017, President Donald 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.

Get Our Top Investigations Subscribe to the Big Story newsletter.

But the money-saving recommendations the consultants came up with made some career ICE staff 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.

McKinsey’s team also looked for ways to accelerate the deportation process, provoking worries among some ICE staff members that the recommendations risked short-circuiting due process protections for migrants fighting removal from the United States. The consultants, three people who worked on the project said, seemed focused solely on cutting costs and speeding up deportations — activities whose success could be measured in numbers — with little acknowledgment that these policies affected thousands of human beings.

In what one former official described as “heated meetings” with McKinsey consultants, agency staff members questioned whether saving pennies on food and medical care for detainees justified the potential human cost.

But the consulting firm’s sway at ICE grew to the point that McKinsey’s staff even ghostwrote a government contracting document that defined the consulting team’s own responsibilities and justified the firm’s retention, a contract extension worth $2.2 million. “Can they do that?” an ICE official wrote to a contracting officer in May 2017.

The response reflects how deeply ICE had come to rely on McKinsey’s assistance. “Well it obviously isn’t ideal to have a contractor tell us what we want to ask them to do,” the contracting officer replied. But unless someone from the government could articulate the agency’s objectives, the officer added, “what other option is there?” ICE extended the contract.

The New York Times reported last year that McKinsey ultimately did more than $20 million in consulting work for ICE, a commitment to one of the Trump administration’s most controversial endeavors that raised concerns among some of McKinsey’s employees and former partners. The firm’s global managing partner, Kevin Sneader, assured them in a 2018 email that the firm had never focused on developing, advising or implementing immigration policies. He said McKinsey “will not, under any circumstances, engage in work, anywhere in the world, that advances or assists policies that are at odds with our values.”

But the new documents and interviews reveal that the firm was deeply involved in executing policies fundamental to the Trump administration’s immigration crackdown. McKinsey’s recommendations for spending cuts went too far for some career ICE employees, and a number of the proposals were never implemented.

McKinsey has faced mounting scrutiny over the past two years, as reports by The New York Times, ProPublica and others have raised questions about whether the firm has crossed ethical and legal lines in pursuit of profit. The consultancy returned millions of dollars in fees after South African authorities implicated it in a profiteering scheme. The exposure of its history advising opioid makers on ways to bolster sales induced the usually secretive firm to declare publicly that its opioid work had ended. Last month, the Times reported that McKinsey’s bankruptcy practice is the subject of a federal criminal investigation. The firm has denied wrongdoing in each case, but it apologized for missteps in South Africa.

“The scope of our work, contractually agreed to during the Obama administration, was designed to help the agency find ways to operate more effectively and cost-efficiently,” a McKinsey spokesman said of the firm’s consulting for ICE. “The focus of our work did not change as a result of these executive orders. The assertion that McKinsey’s work was ‘redirected’ because of these orders is inaccurate.”

In a statement, ICE spokesman Bryan D. Cox said McKinsey’s work “yielded measurable improvements in mission outcomes, including a notable decrease in the time to remove aliens with a final order of removal.”

McKinsey responded quickly to Trump’s executive orders on immigration. On Feb. 13, the consultants presented ICE officials a set of “initiatives to improve ICE Hiring and address the Executive Order,” according to an accompanying slide deck.

Hiring 10,000 immigration officers was an immense undertaking, and similar attempts to swiftly ramp up staffing, under the administrations of George W. Bush and Barack Obama, ended badly. They resulted in lax hiring standards, according to experts, and a subsequent spike in misconduct and corruption cases among Border Patrol officers.

To expedite the process in 2017, McKinsey proposed hiring en masse, including what the consultants called “super one-stop hiring”: ICE could rent a gymnasium or similar space and compress the recruitment, screening and hiring process into a single day. The consultants, they wrote in a slide deck, aimed “to reduce time to hire by 30-50% (hundreds of days)” — significantly improving ICE’s capability to staff the president’s immigration crackdown.

By the summer of 2017, according to contracting records and a former ICE official, the agency had begun to adopt McKinsey’s proposals to speed up hiring. (ICE has hired only a fraction of the 10,000 officers called for because of budget constraints.)

Within months, McKinsey was making significant strides toward advancing the Trump administration’s policy goals. The firm’s work showed “quantifiable benefits,” ICE officials stated in an October 2017 contracting document, “including increased total removals and reductions in time to remove a detainee.”

As some McKinsey consultants worked on the staffing challenge, others took aim at the logistical hurdles posed by an expected influx of detainees flowing from the Trump administration’s directive to enforce immigration laws more strictly.

The consulting team became so driven to save money, people involved in the project said, that consultants sometimes ignored — and even complained to agency managers about — ICE staffers who objected that McKinsey’s cost-cutting proposals risked jeopardizing the health and safety of migrants.

Cox, the ICE spokesman, denied that McKinsey’s recommendations could harm the well-being or due process rights of detainees. McKinsey’s spokesman said the firm’s work aimed to identify where detention center contractors were overcharging ICE — long a concern of watchdog agencies — and to propose remedies.

McKinsey, the firm’s presentations show, pursued “detention savings opportunities” in blunt ways. The consultants encouraged ICE to adopt a “longer-term strategy” with “operational decisions to fill low cost beds before expensive beds.” In practice, that meant shunting detainees to less expensive — and sometimes less safe — facilities, often rural county jails.

“There’s a concerted effort to try to ship folks ICE sees as long-term detainees to these low-cost facilities run by local sheriffs’ offices where conditions are abysmal,” said Eunice Cho, a senior staff attorney at the American Civil Liberties Union who focuses on issues involving the detention of immigrants. (The ACLU has brought several lawsuits against ICE, including over its detention policies, during the Trump administration.)

McKinsey also looked to cut costs by lowering standards at ICE detention facilities, according to an internal ICE email and two former agency officials. McKinsey, an ICE supervisor wrote in an email dated March 30, 2017, was “looking for ways to cut or reduce standards because they are too costly,” albeit, the supervisor added, “without sacrificing quality, safety and mission.”

The consultants found it difficult to attach a dollar figure to the standards themselves, the former ICE officials said. So they shifted their focus to trimming operating costs at several detention centers and coaching agency officials as they renegotiated contracts with companies managing some of those facilities. The renegotiated contracts saved ICE $16 million, according to Cox, the ICE spokesman, who insisted that no “degradation to service” resulted.

One of Trump’s executive orders had directed immigration agencies to concentrate resources near the southern border, and the consultants prioritized slashing costs at those facilities.

The McKinsey proposals that most troubled agency staffers — like cutting spending on food, medical care and maintenance — were not incorporated into the new contracts, one former ICE official said. Internal project emails point to cutbacks in guard staffing as the source of most cost savings.

Read More The Country That Exiled McKinsey A dubious project raises serious questions about the world’s most prestigious consulting firm and its work for corruption-plagued regimes.

But the McKinsey recommendations remain on the books at ICE. The consultants analyzed how the agency could save money at detention centers beyond those where they helped renegotiate contracts — including several near the border, like ICE’s largest family detention facility, in Dilley, Texas — and Cox said these analyses remain reference points for future efforts to curb spending. A report issued this summer by the Department of Homeland Security’s inspector general raised concerns about food quality and upkeep at several ICE facilities, both categories on which McKinsey recommended ICE spend less.

McKinsey’s work at ICE ended in July 2018. Among agency officials, there was growing dissatisfaction with the consultants’ work, and leadership turnover in the agency had left the consulting firm with few defenders, two former ICE officials said.

But the firm’s work supporting the Trump administration’s immigration clampdown has continued. Just a week after Sneader announced that the ICE engagement was over, McKinsey signed a $2 million contract to advise Customs and Border Protection as it drafted a new border strategy to replace the Obama administration’s approach, and it has since signed still another contract with CBP — worth up to $8.4 million — that will keep the firm at the agency through September 2020 at least.

Among the border strategy priorities listed in McKinsey slide decks for the CBP are: “invest in impedance and denial capability,” “work with partner agencies and components to maximize programs that discourage illegal entries” and, in one instance, simply, “Wall.”