Former CIA director John Brennan in May 2017. (Pablo Martinez Monsivais/AP)

What Donald Trump did Wednesday isn’t supposed to happen in a democracy. A president who swore an oath to uphold the Constitution just carried out a personal political vendetta against a career intelligence officer.

In revoking the security clearance of former CIA director John Brennan, Trump took another step toward the abyss. He cited the “risk posed by [Brennan’s] erratic conduct and behavior,” a ludicrous charge coming from our unguided missile of a chief executive.

Brennan’s real crime is that he has been in Trump’s face nearly every day, trading insults on Twitter and cable television. Brennan has taken to using words such as “high crimes and misdemeanors” and “nothing short of treasonous” to describe Trump’s behavior, and likened him to convicted fraudster Bernie Madoff. Stripping Brennan’s clearance was presidential payback, dressed up in national security language.

I wrote back in January that I wished Brennan and other former intelligence chiefs would resist slugging it out with Trump — not because their criticisms are wrong but because they risked tarnishing the credibility and professionalism of their agencies. As I argued, Trump supporters would “fume that the spy chiefs are ganging up on the populist president. Conspiracy theories about an imaginary ‘deep state’ will gain more traction, and the cycle of national mistrust will get worse.”

But let’s be honest: Brennan isn’t a guy who was going to back down in a bar fight, any more than Trump. He’s tough and stubborn, with a chip on his shoulder. He’s a guy who, if you write five positive things about him and one negative, remembers only the negative. Once Trump insulted Brennan’s integrity, as he did after he won the presidency, these two were going to end up in a cockfight.

The prevailing media explanation of the Brennan move was that Trump was trying to distract public attention from Omarosa Manigault Newman, a disaffected former staffer who just published a tell-all book about the president titled “Unhinged.” But I wonder if that was the real Brennan trigger.

Trump himself offered a clearer (and more damning) explanation in an interview Wednesday with the Wall Street Journal, suggesting that he punished Brennan because he was one of the original instigators of the investigation led by special counsel Robert S. Mueller III. “I call it the rigged witch hunt, [it] is a sham. And these people led it! So I think it’s something that had to be done.”

With Trump, you always have to question what’s rubbing him so raw and driving him toward possibly illegal and unconstitutional actions. As prosecutors like to say: “We may not know what he’s done wrong, but he does.” Does a warped protective impulse drive Trump into these furies of defensive action?

With James B. Comey, ground zero may have been the briefing given by the then-FBI director to the president-elect in January, detailing the salacious sexual allegations contained in a now-famous (but unconfirmed) dossier compiled by former British intelligence officer Christopher Steele and funded partly by lawyers representing the Hillary Clinton campaign. Trump brought up this sleazy evidence repeatedly afterward and reportedly pressed Comey for a pledge of personal loyalty. When Trump didn’t get it, he fired his FBI director and, in a television interview, blamed it on Comey’s pursuit of the Russia investigation.

Brennan poses a similar challenge for Trump. It’s not that Brennan embodies the “deep state.” In truth, he disliked a CIA operations culture that he felt had rejected him as a young officer; while his modernization efforts at the CIA had supporters, I’d bet that many at the agency were relieved to see him go.

What was so threatening about the former CIA chief? Beyond Brennan’s sheer cussedness, I’d guess that Trump was frightened — and remains so to this day — about just how much Brennan knows about his secrets. And by that, I don’t just mean his dealings with Russian oligarchs and presidents but the way he moved through a world of fixers, flatterers and money launderers.

Brennan, like Comey, was there at the beginning of this investigation. Trump must have asked himself: What does Brennan know? What did he learn from the CIA’s deep assets in Moscow, and from liaison partners such as Britain, Israel, Germany and the Netherlands? Does Trump think Brennan will be a less credible witness without a security clearance?

The Brennan episode is just one more warning of what may be ahead. Trump appears ready to take our country over the waterfall to save himself. Before it’s too late, Trump should realize: Even in his rage, he can’t fire everybody.

Read more from David Ignatius’s archive, follow him on Twitter or subscribe to his updates on Facebook.