For more than two decades, Attorney General Jeff Sessions’s hostility to immigrants put him on the outer fringes of the Republican Party. When Congress seemed likely to pass comprehensive immigration reform—first in 2007, then in 2013—Sessions worked assiduously to scuttle it. In 2015, after the Republicans took control of the Senate, he circulated a memo titled “Immigration Handbook for a New Republican Majority,” in which he argued that the G.O.P. had lost the Presidency in 2012 partly because it failed to curtail legal immigration to the U.S. The next year, he became the first U.S. senator to back Donald Trump in the Republican Presidential primaries, which at once bolstered Sessions’s flagging public profile and legitimized Trump’s candidacy in the eyes of anti-immigration hawks. (“Sessions was Trump’s Good Housekeeping seal of approval,” Mark Krikorian, the head of the Center for Immigration Studies, an influential anti-immigration think tank, told me last year.) Addressing a group of immigration judges in Virginia last October, Sessions paused to marvel at his own good luck. “I’m just astounded that President Trump made the miraculous intervention, and I’m the Attorney General of the United States,” he said, grinning broadly. “It’s really, really hard to believe.”

On Wednesday, Sessions resigned under pressure from the White House. For the past year and a half, the President, who felt betrayed that Sessions recused himself from the Russia investigation, in March, 2017, had routinely mocked and insulted his Attorney General. Trump upbraided him in the Oval Office, called him a “dumb Southerner” behind his back, and taunted him in speeches and on Twitter. (“I’m so sad over Jeff Sessions because he came to me,” Trump said in September. “He wanted to be Attorney General, and I didn’t see it.”) But, as the Trump Administration adopted increasingly draconian policies, it became clear that, for Sessions, orchestrating the most systematic and wide-reaching assault on immigrants in modern history was well worth enduring near-constant humiliations from the President. As the government’s top lawyer, Sessions was responsible for, among other things, cancelling DACA, spurring family separations, trying to defund sanctuary cities, dismantling the asylum system, reshaping the immigration courts, and retooling multiple travel bans. To the extent that the President has styled himself as an anti-immigration crusader, it’s with a script written entirely by Sessions.

Trump’s immigration agenda has always faced an administrative hurdle that Sessions was particularly determined, and well-positioned, to try to overcome: the President wants to deport more people than the machinery of the federal bureaucracy can possibly process. When Sessions took over as Attorney General, in January, 2017, there was a backlog in the country’s immigration courts of more than five hundred thousand cases, and the number has since grown to more than a million. Meanwhile, at Trump’s urging, Immigration and Customs Enforcement has been increasing the number of people it arrests, which has only compounded the problem. In April, Sessions, who presided over the country’s immigration-court system as the Attorney General, instituted a quota to force judges to hear seven hundred cases a year—about three per day—and then further restricted their ability to weigh evidence in individual situations. A former immigration judge told the Times, “Sessions is treating them like immigration officers, not judges.”

Sessions claimed to be making these changes in the name of efficiency, but his real motives were easy to discern. In May, he issued a ruling forbidding immigration judges from exercising a crucial form of discretion called “administrative closure.” As the court backlog has grown in the last several years, judges have frequently closed cases when an immigrant did not face imminent deportation. As of September, 2018, some three hundred and fifty thousand cases had been dismissed because the defendants were considered such a “low priority” for arrest by the enforcement standards established under President Obama. Sessions declared this practice illegal. A few weeks later, lawyers at ICE received a memo that cited his decision and instructed them to reopen old cases. According to the document, “there is no burden to provide a persuasive reason” for rescheduling the cases, “or to provide any reason at all.” The signal from Sessions was justification enough. In the past fiscal year, ICE lawyers have already reopened about eight thousand previously closed deportation cases.

What made Sessions so dangerous as Attorney General was his technical knowledge of which levers to pull to advance his agenda. As the head of the Justice Department, Sessions made frequent use of a fairly obscure authority to refer pending immigration cases to himself for review; in eight such cases that had come before a body known as the Board of Immigration Appeals, he ultimately issued his own, superseding legal judgments. (By contrast, this referral power was used nine and four times during the entirety of the Bush and Obama Presidencies, respectively.) In three instances, including the case involving administrative closure, Sessions ruled on how to manage the immigration court docket to facilitate increased deportations. In the remaining five, he attempted to redraw the system for how the U.S. government grants asylum. “He knew when he got the job what power he was getting,” Sarah Pierce, an analyst at the Migration Policy Institute, told me. “And you could see, based on the cases he referred to himself, what his priorities were.”

The most consequential of these cases involved a Salvadoran woman who had been granted asylum in the U.S. after escaping an abusive husband in 2014. In June, Sessions reversed the ruling on the grounds that victims of domestic abuse and gang violence no longer qualified for protection under U.S. law. Legal experts estimated that Sessions had single-handedly dismantled between sixty and seventy per cent of asylum jurisprudence from the previous three decades. An asylum officer at the United States Citizenship and Immigration Services told me, “Ninety per cent of the people I’ve referred to a judge for an asylum hearing were referred on the basis of gang-related violence or domestic violence in Central America. Now what?” Sessions’s ruling came just as the Trump Administration, under a so-called zero-tolerance policy advanced by Sessions, was separating families as they sought asylum at the border. Parents who fled to the U.S. with their children, Sessions claimed, were scarcely better than human smugglers secreting contraband. “If you are smuggling a child, then we will prosecute you,” he said. “That child will be separated from you as required by law.”

Where immigration policy is concerned, Trump will be hard-pressed to find an Attorney General as ideologically single-minded and crafty as Sessions was. Yet Sessions’s departure will likely do little, if anything, to slow the broader agenda he’s already set in motion. In large part, this is because Sessions can rely on a cabal of former staffers and loyalists across the federal bureaucracy to carry on in his absence. The most notorious and powerful of them is, of course, Stephen Miller, who is now leading the President’s crackdown on immigrants as a senior policy adviser in the White House. Others are less well known, but nearly as influential. Gene Hamilton, another former Sessions staffer (like Miller, he joined the Trump campaign in 2016), is a counsellor at the Justice Department and served briefly at the Department of Homeland Security advising then-Secretary John Kelly. Hamilton wrote the memo ending DACA, partnered with Miller to sabotage the refugee program, directed officials at D.H.S. to separate families, and worked to quietly end a raft of humanitarian protections that have long defined U.S. immigration policy. L. Francis Cissna, who, as the head of U.S.C.I.S., is trying to punish legal immigrants for using public benefits, worked with Sessions as a staffer on the Senate Judiciary Committee—as did Cissna’s deputy, Kathy Nuebel Kovarik. Others, like Dimple Shah, a lawyer at the Department of Homeland Security, and Julie Kirchner, now the ombudsman at U.S.C.I.S., are also hardened ideologues who came out of Sessions’s political network. In effect, Sessions’s reach extends across every government agency that shapes immigration policy.

Since it was Trump who severed his relationship with Sessions, and not the other way around, there’s a temptation to cast the President as the one who got the better of their partnership. The opposite may be closer to the truth, however. In less than two years, Jeff Sessions managed to import his world view into the upper echelons of the U.S. government; Trump was Sessions’s mouthpiece, and his lifeline out of political obscurity. When Sessions was weighing whether to endorse Trump, in February, 2016, Steve Bannon had to persuade him. “Trump is a great advocate for our ideas,” Sessions told Bannon, according to Joshua Green’s book “Devil’s Bargain.” “But do you think he can win?” he asked. Bannon replied, “One hundred per cent. If he can stick to your message and personify this stuff, there’s not a doubt in my mind.”