President Donald Trump’s fury over the Russia probe has just led to the ouster of the man who most embodies Trumpism — and who played a key role in Trump’s surprise election win in 2016.

On Wednesday, just one day after the midterm elections, Trump asked Attorney General Jeff Sessions to resign, ending the longtime Alabama senator’s nearly two years running the Department of Justice.

Trump tweeted that Matthew Whitaker, Sessions’s chief of staff, will take over as the acting head of the Justice Department, adding that a permanent replacement will be announced soon. “We thank Attorney General Jeff Sessions for his service, and wish him well!” Trump continued.

Sessions also wrote a resignation letter, which he says Trump requested, in which he outlined much of what he did in office, such as combat gangs. “I have served honorably as your Attorney General and have worked to implement the law enforcement agenda based on the rule of law that formed a central part of your campaign,” he wrote.

The move had been telegraphed on Capitol Hill, with top Republican senators and former Sessions allies like Sen. Lindsey Graham of South Carolina and Sen. Chuck Grassley of Iowa saying they expected Sessions’s ouster after the midterm elections.

The resignation took few by surprise. Trump has been expressing his anger at Sessions for months, prompting repeated questions about how long the attorney general would keep his job. (Sessions is known to have offered to resign at least once; Trump refused to accept it.)

“This was not unexpected,” Carl Tobias, a law professor at the University of Richmond, told Vox. “Sessions tolerated more abuse from Trump than any Cabinet member should have to endure. Yet, he soldiered on out of a sense of duty.”

Trump added fuel to the fire during an August 23 interview with Fox News. “I put in an attorney general who never took control of the Justice Department,” the president said. “Even my enemies say that Jeff Sessions should have told you that he was going to recuse himself and then you wouldn’t have put him in.”

Sessions responded mere hours later. “I took control of the Department of Justice the day I was sworn in, which is why we have had unprecedented success at effectuating the President’s agenda — one that protects the safety and security and rights of the American people reduces, violent crime, enforces our immigration laws, promotes economic growth, and advances religious liberty,” Sessions said in a written statement.

“While I am Attorney General, the actions of the Department of Justice will not be improperly influenced by political considerations,” he added.

Sessions’s defense hasn’t stopped Trump from publicly blasting him. In September, for example, Trump targeted Sessions after the Justice Department indicted two Republican members of Congress.

“Two long running, Obama era, investigations of two very popular Republican Congressmen were brought to a well publicized charge, just ahead of the Mid-Terms, by the Jeff Sessions Justice Department,” Trump tweeted on September 3. “Two easy wins now in doubt because there is not enough time. Good job Jeff......”

And the president continually criticized Sessions, the nation’s top law enforcement official, for recusing himself from the probe into whether the Trump campaign colluded with Russia, a move that set the stage for the appointment of special counsel Robert Mueller. Trump has also complained that Sessions wasn’t sufficiently loyal because, since then, he has failed to prevent Mueller from indicting a growing number of Trump confidantes and targeting others.

The irony of Sessions’s departure is that Trump has removed one of his most loyal foot soldiers, which could imperil other parts of the president’s agenda.

Sessions was one of the first senators to endorse Trump, and used his time as the nation’s top law enforcement officer to implement the anti-immigration “tough on crime” policies that were at the core of Trump’s campaign.

Sessions pulled back federal oversight of local police departments. He’s moved to prosecute anyone who illegally crosses the US-Mexico border regardless of the conditions they’re escaping back home, while pushing immigration judges to take on more deportation cases. He rescinded previous limitations on harsh mandatory minimum prison sentences for low-level drug offenses, and asked prosecutors to consider the death penalty in some drug trafficking cases.

Whether Trump realizes it or not, he has let his fury over the Russia investigation threaten his policy agenda — throwing his already chaotic presidency into even more chaos.

Trump thought about getting rid of Sessions last year. Now he’s finally done it.

The longstanding questions over the Trump campaign’s ties to Russia hobbled Sessions from the start.

During his January 2017 confirmation hearings, Sessions told senators — while under oath — “I have been called a surrogate at a time or two in that campaign and I did not have communications with the Russians.”

As the Washington Post reported soon after, Sessions did meet with Russian officials during the presidential campaign — specifically with Russia’s then-ambassador to the US, Sergey Kislyak.

Sessions later claimed that he misunderstood the original question, and meant to say that he had only met with Russian officials in his capacity as a US senator, not as a surrogate to the Trump campaign. In March, he said, “I never had meetings with Russian operatives or Russian intermediaries about the Trump campaign.”

That was also untrue: In July 2017, the Post reported that Sessions had, in fact, talked with Kislyak about the presidential election during the campaign.

Sessions recused himself from the Trump-Russia probe on March 2, 2017, because of his own ties to Moscow, a move that was hailed by former Justice Department officials from both parties.

That put the Russia probe in the hands of Deputy Attorney General Rod Rosenstein, who would later name Mueller as the special counsel. Trump routinely derides Rosenstein, calling him a Democrat even though he’s a lifelong Republican.

Rosenstein has repeatedly declined to say he would fire Mueller even if Trump asked him to (Rosenstein is technically the only one with the authority to fire Mueller, though Trump could simply oust Rosenstein and order his replacement to do so).

Sessions’s recusal infuriated Trump. In an interview with the New York Times in July 2017, Trump lashed out at Sessions for his decision: “Sessions should have never recused himself, and if he was going to recuse himself, he should have told me before he took the job, and I would have picked somebody else.”

That anger transferred over to another of Trump’s gripes: that Sessions would not investigate alleged connections between Hillary Clinton and Russia during the presidential campaign. Trump also fumed about this on Twitter in July 2017, going so far as to call him “VERY weak.”

Attorney General Jeff Sessions has taken a VERY weak position on Hillary Clinton crimes (where are E-mails & DNC server) & Intel leakers! — Donald J. Trump (@realDonaldTrump) July 25, 2017

According to reports at the time, Trump hoped his mockery of Sessions would humiliate him into resigning. But on July 27, 2017, Sessions told Fox News’s Tucker Carlson that he wasn’t ready to go.

“I’m confident I made the right decision,” he told Carlson about the recusal. “The decision is consistent with the rule of law. And an attorney general who doesn’t follow the law is not very effective in leading the Department of Justice.”

He added: “I serve at the pleasure of the president. If he wants to make a change, he can certainly do so.” Mueller is currently investigating whether Trump’s alleged efforts to push Sessions out last year via Twitter ridicule formed part of an effort to obstruct the probe, which would be a potentially criminal offense. It’s unclear if Mueller will also investigate Trump’s use of Twitter in 2018 against Sessions.

Tensions continued to simmer for months — and those tensions became publicly evident nine months before the midterm elections.

February 2018: the beginning of the end for Sessions

On February 28, 2018, Trump complained that Sessions wouldn’t corroborate his unfounded belief in the existence of a widespread conspiracy, led by federal law enforcement personnel, to undermine Trump’s candidacy during the 2016 presidential election.

Why is A.G. Jeff Sessions asking the Inspector General to investigate potentially massive FISA abuse. Will take forever, has no prosecutorial power and already late with reports on Comey etc. Isn’t the I.G. an Obama guy? Why not use Justice Department lawyers? DISGRACEFUL! — Donald J. Trump (@realDonaldTrump) February 28, 2018

There’s no evidence to back this theory up. Trump believes the FBI tricked the Foreign Intelligence Surveillance Court (FISC) to surveil a former campaign member, Carter Page, based on a Democrat-connected dossier. That, Trump supporters claim, started the process that eventually led to special counsel Mueller’s probe into possible Trump-Russia collusion during the 2016 presidential election — a probe Trump consistently labels a “WITCH HUNT!”

But Trump is wrong. We now know the Trump-Russia investigation began (at least in part) because a former Trump campaign aide George Papadopoulos told Australia’s ambassador to the United Kingdom that Russia had “dirt” on Hillary Clinton in the form of thousands of hacked emails.

Further, surveillance of Page was justified by ample corroborating evidence beyond the so-called “Steele dossier” and was renewed several times because judges — all appointed to the federal bench by GOP presidents and selected for FISC duty by Supreme Court Justice John Roberts, who was also appointed by a Republican — deemed the ongoing surveillance to be fruitful.

But Trump still believes what Fox News tells him: He’s the victim. In a move clearly intended to mollify the president, Sessions on February 27 asked the Justice Department’s inspector general to look into the alleged abuse. Whatever the intent, that clearly wasn’t enough for Trump.

Then things got a little dramatic. On February 28, the day of Trump’s complaints on Twitter, Sessions had a very public night out at dinner with Rosenstein and Solicitor General Noel Francisco. As Vox’s Matt Yglesias pointed out, the seemingly innocuous meal was actually a public display of defiance: It “was a powerful symbol of both the attorney general’s independence from Trump and the limits of that integrity.”

Trump put Sessions and Rosenstein in his crosshairs because they won’t stop Mueller’s probe. For Sessions to dine with Rosenstein on the same day Trump called him out on Twitter shows that the attorney general was distancing himself from the president.

It was quite the public breakup for two formerly great colleagues and friends.

Remember: Sessions was the first senator to endorse Trump, back when Trump’s candidacy was still a huge point of controversy in the Republican Party. And he has consistently backed Trump’s agenda, particularly Trump’s anti-immigration and “tough on crime” policy proposals.

But that didn’t matter: The bottom line, to Trump, was that Sessions had done something that he saw as unfair and harmful to his presidency. So Trump fired Sessions, and may permanently replace him with someone who will help slow, or halt, the Mueller probe.

That could help Trump with his legal problems. But in the long term, removing Sessions means Trump has lost a crucial ally in pushing and enforcing his key agenda items.

Trump’s decision to push Sessions out is a huge blow to Trumpism

After the Times posted its July 2017 interview with Trump, Fox News’s Carlson, who’s typically pro-Trump, did something he rarely does on his show: He criticized the president.

Carlson called Trump’s comments about Sessions “a useless, self-destructive act,” and described Sessions as “the closest ally Trump has in this administration.”

He went on:

As attorney general, Sessions has been the rare person in the entire executive branch making actual progress implementing the agenda his boss ran on, because he’s the rare person who believes in it. … He’s gone after sanctuary cities, he’s enforced immigration laws, he’s ended the Obama administration’s attacks on local police departments, and a lot more.

Carlson’s general point is correct: While much of the president’s agenda, from his travel ban to Obamacare repeal, has been held up or diluted in the courts and Congress, Sessions has been the rare figure putting real policy gravitas behind Trumpism.

For example, shortly after taking office, Sessions said that the Justice Department would “pull back” from conducting federal investigations into local police departments. These investigations had been a high priority for the Obama administration, not only uncovering massive police abuses at several police departments around the country, particularly against black Americans, but also forcing the police departments to adopt reforms to address these abuses.

But these investigations drew a lot of criticism from Sessions and other supporters of “tough” policing tactics, with Sessions and others characterizing the investigations as part of a broader “war on police” that’s made it harder for cops to be as aggressive as possible.

(Sessions argues the aggressive policing tactics are necessary to crack down on crime. But experts disagree, and Black Lives Matter activists in particular point out that such aggressive tactics disproportionately hurt and kill minority Americans.)

Sessions also rescinded an Obama-era memo sent out by then-Attorney General Eric Holder in 2013, which told federal prosecutors to avoid charges for low-level drug offenders that could trigger lengthy mandatory minimums. His new memo says that “prosecutors should charge and pursue the most serious, readily provable offense” even when dealing with low-level drug crimes, calling this concept “a core principle” of the Justice Department.

In short, Sessions wanted to re-escalate the war on drugs.

And in response to the opioid epidemic, Sessions gave weight to a Trump proposal to execute drug traffickers by signing off on a memo that asked federal prosecutors to consider the death penalty for cases “dealing in extremely large quantities of drugs.” (The evidence doesn’t support this and other “tough” approaches for drugs.)

This was all exactly as Trump promised. In 2015, Trump outright told MSNBC that he’s “tough on crime.” He praised Vice President Mike Pence for, as governor of Indiana, increasing mandatory minimum sentences for drug crimes. And he said police should be more aggressive than they are today, particularly by using the controversial “stop and frisk” strategy that a court struck down in New York City because it was used to target minority Americans.

These are just a few examples, but on practically every single issue that the Justice Department oversees — whether it’s policing, prisons, immigration, or voting rights, all of which make up key parts of Trumpism — Trump and Sessions were in agreement.

As even Trump allies like Carlson admitted, this makes it all the stranger that Trump lashed out at Sessions. But it drives home that Trump isn’t as interested in implementing his agenda as he is in stifling the Russia investigation by any means necessary. And that means the next months of the Trump era threaten to be even uglier and chaotic than the ones that preceded them.