A curious belief in some circles of journalism holds that if both sides are equally unhappy with your story, you’ve done a good job. I never subscribed to that approach, and thankfully, President Trump didn’t when it came to the performance of James Comey.

The suddenly former FBI boss was long cavalier about making enemies among both Democrats and Republicans, as if going rogue repeatedly proved his rectitude. On occasion it did, but Comey increasingly wore his self-righteousness on his sleeve, confident he was too big to fire.

That was his fatal mistake. And it’s why Trump made the right decision to show him the door.

Comey’s power-grabbing arrogance is why I called him “J. Edgar Comey” two months ago. His willingness to play politics, while insisting he was above it all, smacked of Washington at its worst. He was the keeper of secrets, until they served his purpose.

As such, the president did to Comey what no president had the courage to do to J. Edgar Hoover. Five presidents wanted to fire Hoover, with Harry Truman accusing him of running a police state and of blackmail. But all were afraid of Hoover, so he died in office.

Trump acted before Comey could get that kind of lifetime protection, which has no place in American democracy. At our best, we are a nation of laws, not of people who accumulate power and ruthlessly wield it without accountability.

The president didn’t have just one good reason to act. He had a choice among many.

The one he cited, Comey’s handling of the investigation into Hillary Clinton’s private server, is rich with irony, given its prominence in the campaign. And the irony doesn’t stop, with Democrats who not so long ago were furious with Comey over the Clinton probe rushing out condemnations of Trump for firing him.

“Nixonian” was a common theme, a shot both cheap and predictable. When you’re a hammer, everything is a nail. When you’re a Democrat, everything is Watergate.

Except Comey makes a very poor victim, especially because the Justice Department’s investigation of his handling of the Clinton probe — started by the Obama administration — did him in.

Comey’s refusal to accept the department’s conclusion that he made major mistakes is reasonable grounds for dismissal of any employee in any circumstance, not least one who enjoys self-aggrandizing displays of independence.

It is understandable that his bosses, Attorney General Jeff Sessions and his recently confirmed deputy, Rod J. Rosenstein, lost confidence in Comey. They pushed for his ouster, and the president agreed.

Yet Comey could have been fired for other aspects of the Clinton probe. The failure to empanel a grand jury, the willingness to destroy evidence as part of immunity agreements, the absurd claim that no reasonable prosecutor would take the case — each action and assertion suggested a less-than-thorough probe designed to please his Democratic bosses.

Then there are the leaks of investigations that amounted to a flood of illegal disclosures about the Trump administration. Virtually everything we know about whether anyone in the Trump campaign colluded with Russian meddling in the election comes through leaks.

The names of those supposedly being investigated — Gen. Michael Flynn, Paul Manafort, Carter Page — were all made public through leaks. The fact that Sessions himself was wrong to tell the Senate he had not met with the Russian ambassador — we know that because of leaks to the Washington Post.

We know a computer server for Trump Tower was communicating with a Russian bank — because of leaks. Not incidentally, Hillary Clinton jumped on those leaks to insist Trump was guilty of collusion.

Only later did we learn — through leaks — that the FBI determined the server was sending spam.

Yet Comey adamantly insisted to Congress that he could not even confirm that he was investigating any or all of these leaks — and that was that.

Then there were the reports that Comey himself was furious that Trump had accused the Obama White House of “wire tapping” Trump Tower . How do we know Comey was furious? Take a guess.

Years ago, Comey let it be known to the liberal press that he had threatened to resign under President George W. Bush unless he got his way on a document related to the war on terror.

He also insisted on a special prosecutor in the Valerie Plame case, which ended up convicting the wrong man in an enduring injustice.

That background made him a hero to Democrats, which is why Obama made him head of the FBI in the first place. Then he finally drove the Dems crazy, with Obama’s Justice Department investigating him and Clinton blaming him for her loss.

So Comey exits, forced off the stage after giving everybody he ever worked for legitimate reasons to be unhappy with his performance.

That is not a virtue.