When Kevin McAleenan became the acting Secretary of Homeland Security, in April, a D.H.S. official, who knew McAleenan personally, told me, “I’m not sure how he can finesse things with this Administration.” Donald Trump had just fired Kirstjen Nielsen, a former official in the George W. Bush Administration, despite the fact that she had championed some of the Trump Administration’s harshest immigration policies, including family separation. McAleenan, who had served in the Obama Administration, was widely regarded as a Democrat. He publicly opposed Trump’s decision, earlier that spring, to cut aid to Central America, and was taking over the Department at a moment when more than a hundred thousand migrants were being apprehended at the border in a single month. On Friday, after six months in the post, McAleenan resigned, becoming one of the shortest-serving secretaries in the department’s history. And yet, according to three people with knowledge of McAleenan’s thinking, the Secretary had somehow managed to leave the Trump Administration mostly on his own terms. The reasoning behind the decision, one of them told me, “was sixty per cent because he had achieved the mission objectives, and forty per cent because he had to avoid being branded as Trump’s border cop.”

McAleenan’s primary goal was reducing immigration to the U.S., which aligned him with the White House. But, unlike Trump or his chief adviser, Stephen Miller, McAleenan was never an anti-immigration ideologue. He is a technocrat and an institutionalist who had spent much of his career at Customs and Border Protection, a D.H.S. sub-agency. In his view, mass migration was a humanitarian crisis which threatened to overtake both D.H.S. resources and the asylum system writ large. It was a problem, he once told me, that partisan Washington was unable to address. At the same time, according to another department official close to him, McAleenan saw Trump’s election as proof that an unsolved immigration crisis could carry dangerous political consequences.

In terms of immigration numbers, though, McAleenan succeeded where his predecessors failed. He was the fourth person to lead the department in the Trump era but the first with extensive experience on immigration policy. “I wouldn’t make a move or decision in the immigration space without consulting Kevin first,” Jeh Johnson, who headed D.H.S. under President Obama, told me. Each of McAleenan’s predecessors, under sustained pressure from the White House, adopted drastic immigration measures, but immigration at the southern border continued to rise steadily. By the start of 2019, it reached its highest levels in more than a decade. McAleenan responded with a controversial slate of policies that enlisted governments in Central America and Mexico to ramp up their own immigration enforcement. By September, the number of immigrants apprehended at the southern border had declined by sixty-three per cent.

Trump never exactly soured on McAleenan, but he undercut him. For one thing, the President did not formally nominate McAleenan for Senate confirmation, which eroded his standing within the Administration. D.H.S. consists of twenty-two agencies, with an annual budget of fifty billion dollars and some two hundred and forty thousand employees, spanning the Secret Service, the Federal Emergency Management Agency (FEMA), the Coast Guard, the Transportation Security Administration, and Immigration and Customs Enforcement (ICE). Its portfolio includes briefs related to domestic terrorism, cybersecurity, and disaster relief. “We always had to work extremely hard to make sure the department didn’t get turned into a political tool,” one former D.H.S. official told me last year. “We tried to run it like other departments that were above the fray, but it’ll always be a challenge because of the immigration issue.” Among many current and former D.H.S. officials, however, there was rising concern that the President’s obsessive focus on immigration enforcement was dragging the department even further into the realm of domestic politics. At one point earlier this summer, Trump bumped into McAleenan in Washington just before the secretary was due to give a speech on cybersecurity. “Why aren’t you at the border?” Trump asked him, according to someone present at the time.

In June, Trump named two partisan appointees to key posts within D.H.S.—Ken Cuccinelli, the former Virginia attorney general, to lead Citizenship and Immigration Services, and Mark Morgan, to head C.B.P.—both of whom routinely sidestepped McAleenan, their direct boss, in press conferences and appearances on Fox News. This summer, while McAleenan was negotiating an emergency funding bill on the Hill—in part, by trying to convince restive Democrats that D.H.S. would use appropriations for humanitarian, not enforcement, efforts—Cuccinelli and Morgan publicly championed a nationwide ICE operation that the President had announced, to the agency’s surprise, on Twitter. McAleenan had opposed the operation, which targeted immigrant families, but Cuccinelli and Morgan rallied to the cause. “What I don’t have control over is the tone, the message, the public face and approach of the department in an increasingly polarized time,” McAleenan later told the Washington Post. “That’s uncomfortable, as the accountable, senior figure.”

But if McAleenan passed as a moderate steward of D.H.S. in the context of Trump’s Washington—a policy wonk and diplomat, who was data-driven and cautious—by almost any other standard, his tenure was marked by aggressive measures that have wreaked havoc on the lives of migrants. During the past six months, McAleenan has presided over two elaborate new policies designed to enlist foreign governments in the effort to take pressure off of the U.S. asylum system. The first, called the Migrant Protection Protocols (M.P.P.), came into existence while McAleenan was the head of C.B.P. It has since forced some fifty thousand Central American asylum seekers to wait in Mexico while their legal claims move through the backlogged U.S. immigration courts. Initially, the program was designed to handle the influx of Central Americans, but late this spring, under McAleenan’s leadership, D.H.S. broadened M.P.P. to include asylum seekers from any Spanish-speaking country in Latin America. McAleenan has defended M.P.P. as a necessary stopgap to allow asylum seekers access to U.S. immigration courts, while keeping them off American soil. In practice, however, hundreds of asylum seekers have been brutalized while stranded in notoriously dangerous Mexican border cities, and thousands of others, out of fear for their safety, have abandoned their asylum claims altogether.

Over the summer, I spoke to a twenty-two-year-old Guatemalan named Deysi, whose asylum claim was promising even by the strictest legal definitions of the term. A lesbian who’d been raped and assaulted repeatedly in her home town, in southern Guatemala, she travelled to El Paso to seek relief at a port of entry, and was eventually returned to Juárez, under M.P.P., on the same day that McAleenan took over at D.H.S. She slept in a park because the city’s shelters were full. “I knew I had a court date,” she said in a subsequent affidavit. “But I had no paper with the date, the time, and what I need to do to get to court.” By the end of May, she’d missed her court appearance and run out of money. At that point, she tried crossing the border between points of entry and was arrested by Border Patrol agents. Since she’d missed her previous court hearing, she now had an order of removal. When we spoke, Deysi was back in Guatemala, desperate to leave but too scared to set out again for the U.S.