President Trump informed FBI Director James Comey he had been dismissed on May 9, stemming from a conclusion by Justice Department officials that he had mishandled the probe of Hillary Clinton's emails. (Bastien Inzaurralde/The Washington Post)

President Trump fired FBI Director James B. Comey on Tuesday. And while the termination happened rather quickly — mere hours after Comey's faulty testimony to Congress was revealed — it wasn't altogether a shock.

Over the past several weeks, Trump seemed to be in the market for a reason to get rid of Comey. This was an Obama appointee whom Trump derided during the 2016 campaign for not recommending charges against Hillary Clinton for her use of a private email server. Then, in March, Comey announced that the FBI was investigating alleged ties between Russia and the Trump campaign. He also cast doubt on Trump's claim that the Obama administration wiretapped him during the campaign.

Against that backdrop, Trump firing Comey is bound to look suspicious. And Democrats are already crying foul, with Sen. Robert P. Casey Jr. (D-Pa.) quickly labeling the move “Nixonian.” But it's also true that if there was any time to fire Comey, Comey just gift-wrapped it to Trump and served it on a platter.

A couple of weeks after Comey made those announcements in March, Trump talked about his job security at length in a pretty conspicuous way, re-litigating the FBI chief's handling of the Clinton investigation.

“Don't forget, when Jim Comey came out, he saved Hillary Clinton,” Trump told Fox Business in an interview airing April 12. “People don't realize that. He saved her life, because — I call it Comey won. And I joke about it a little bit. When he was reading those charges, she was guilty on every charge. And then he said she was essentially okay. But he — she wasn't okay, because she was guilty on every charge.

“Director Comey was very, very good to Hillary Clinton, that I can tell you. If he weren't, she would be, right now, going to trial.”

It was pretty clear at that point that Trump still harbored hard feelings about Comey's decision — even though he had praised Comey's announcement of newly discovered Clinton emails late in the 2016 campaign.

Then last week, Trump fired off a couple of tweets that made the same case about Clinton.

Asked in the Fox Business interview whether Comey's job was safe, Trump offered no assurances: “It's not too late, but, you know, I have confidence in him. We'll see what happens. You know, it's going to be interesting.”

“We'll see what happens.” Well, we just saw what happened.

Trump has a tendency to signal publicly to people when they are on thin ice. Think Stephen K. Bannon. And in retrospect, that's pretty clearly what was happening with Comey.

Trump said he had confidence in Comey, but the rest of his comments suggested otherwise. This was a wild card in charge of the FBI — a wild card who had the ability to make Trump's life quite difficult, depending on the decisions he made — and Trump clearly didn't trust him.

But firing him was also very, very difficult — and will be a highly controversial decision. Yet the beauty of what transpired Tuesday for Trump is that he had a great set of circumstances under which to do it. Comey's foul-up — misstating facts about the Clinton investigation at a Senate Judiciary Committee hearing last week — looked like he was overselling that case against Clinton, not Trump. It was actually Democrats who could be righteously indignant about Comey's botched claims that top Clinton aide Huma Abedin forwarded hundreds of thousands of emails — some with classified information — from Clinton's server to her then-husband, disgraced former congressman Anthony Weiner.

In firing Comey, Trump doesn't look like he was covering his own behind — at least not transparently so. But from the outside looking in, it sure looks like the president didn't have much regard for Comey and was, in fact, suspicious of him and what he might do. And then Comey gave him a golden opportunity to cut bait.