Andrew McCabe stepped down as the FBI's deputy director in January and had planned to officially retire on Sunday, but Attorney General Jeff Sessions fired him Friday night — a little more than 24 hours before the 20-year bureau veteran would have qualified for full retirement benefits.

White House press secretary Sarah Huckabee Sanders had said on Thursday that President Trump would leave the decision to Sessions. “But,” she added, “we do think that it is well documented that he's had some very troubling behavior and, by most accounts, [is] a bad actor.” In addition, Trump in tweets had mused about McCabe's pension and suggested Sessions should have removed him sooner.

All available evidence suggested Trump wanted McCabe to be fired. And indeed, in the wee hours of Saturday morning, the president celebrated McCabe's ouster, on Twitter.

Why, besides spiting a man Trump has pilloried as a deep-state enemy, would the president have wanted this outcome? There are several reasons:

To deter future leaks

Trump has railed against leaks to the media but has had little success stopping them. Firing McCabe could be a scare tactic to deter others from talking to reporters.

The FBI's Office of Professional Responsibility recommended firing McCabe as punishment for allegedly authorizing the sharing of information with the Wall Street Journal in October 2016 and then misleading internal investigators about his actions. A person familiar with the matter told The Washington Post that McCabe privately denies misleading anyone.

To chill critics in law enforcement

It is far from clear that McCabe exhibited anti-Trump bias in his work at the FBI. Trump has promoted a flawed theory that Democratic groups allied with Hillary Clinton poured money into the state senate campaign of McCabe's wife while the FBI was investigating Clinton's use of a private email server as secretary of state, thus buying improperly soft treatment from the bureau.

The problem with this theory is that McCabe was not “in charge” of the Clinton email investigation at the time of his wife's campaign. He did not become the FBI's deputy director until 2016 and only then “assumed, for the first time, an oversight role in the investigation into Secretary Clinton's emails,” according to the agency. When the campaign contributions were made, in 2015, currying favor with McCabe would have been of little value, making it unlikely that the donations were some kind of bribe.

However unfair Trump's attack on McCabe might be, firing McCabe could be a warning to others that if the president thinks you are his enemy, he might come after you.

To show power over Sessions

Though Sanders said McCabe's fate would be up to Sessions, it was not hard to infer Trump's desire. And Trump has not held back when he disagrees with his attorney general.

Sessions's firing of McCabe could be a sign that the president's bullying has worked, to some degree, and made Sessions more likely to do Trump's bidding.

To tarnish the special counsel's Russia investigation

McCabe was acting director of the FBI during the first few months of special counsel Robert S. Mueller III's probe of Russian interference in the 2016 presidential election — a period in which Mueller removed FBI agent Peter Strzok from the case for bashing Trump in text messages to a bureau attorney with whom he was having an extramarital affair.

Trump has described the text messages as “BOMBSHELLS,” and some Republicans, most notably Sen. Ron Johnson (Wis.), have claimed they are evidence of a broader conspiracy against Trump that taints Mueller's investigation.

In reality, the evidence is flimsy. And, remember, the Office of Professional Responsibility's recommendation to fire McCabe is based on his alleged role in a leak related to the Clinton email investigation, not anything to do with the Russia probe.

But with a little muddying of the waters, McCabe's firing could be used to further impugn the integrity of the special counsel's work.

To look like a champion of the working class

During an appearance on “Fox & Friends” on Thursday, counselor to the president Kellyanne Conway said that Trump, in Missouri a day earlier, had met “a tearful cafeteria worker ... saying thank you for my tax cut.”

Host Ainsley Earhardt then drew a line to McCabe: “He gets to live on a pension that that hard-working lady has to pay for, for the rest of his life? It's just — it doesn't seem fair. And Jeff Sessions, he's the AG, he has the ability to fire that guy so that this hard-working lady ... doesn't have to pay for this guy's pension.”

Conway, like Sanders, said it is up to Sessions to make the call. “I will just say,” Conway added, “on the broader issue of fairness and accountability, it's part of how Donald Trump got elected in the first place.”

One ready-made argument is that canning McCabe is a way of looking out for working-class voters.