Justice Department Inspector General Michael Horowitz’s report Thursday slammed former FBI chief James Comey for abuses committed at the end of his career, after he’d been fired. But the ugly truth is that Comey started going wrong long before then.

This report focuses on one narrow topic: Comey’s abuses of memos he wrote on the job, recounting work-related conversations with President Trump.

The wrong wasn’t in writing them, or sharing them with a few top aides. It was in, 1) keeping his own copies of what were clearly official FBI records after he’d been fired, in blatant violation of FBI policy and his Employment Agreement. And in then, 2) improperly sharing them, including leaks to the press, to serve his personal interests.

Not the public interest, not even if you think the public was served by Comey’s claimed goal of forcing the appointment of a special prosecutor to take over the Russia investigation. As the IG notes, “Comey had several other lawful options available to him to advocate for the appointment of a Special Counsel.”

No, what the leaking did was allow him to immediately counter the nasty things Trump had been saying about him — rather than wait a few days to have his say in already-scheduled testimony to Congress.

Trump’s remarks greatly offended Comey’s view of himself as an ethical paragon. How ironic that the former G-man responded with a massive ethical violation.

Or, rather, another one, because Comey had been crossing lines for most of the prior year (at least). He went along with the Obama administration whitewash of Hillary Clinton’s e-mail scandal, meekly accepting Justice Department orders that rendered the FBI investigation a complete joke. Then — in a spastic effort to square that failing with his high self-image — he took it upon himself to publicly spell out just how “utterly careless” Clinton had been even as he announced that he wouldn’t call for her prosecution.

His duty, faced with massive political interference with a criminal investigation, was to resign — not to protect his job.

Self-preservation also explains his announcements, in the runup to Election Day, that he was reopening and then re-closing the Clinton investigation: It wasn’t about what he’d promised Congress, but about how he thought he’d look later on, when the world learned that he’d done his work quietly.

At the same time, he was playing more double games by playing along with the Team Obama abuse of the intelligence community and Justice Department to spy on the Trump campaign — and then, after Trump’s surprise win that November, to set up the whole vast “collusion” frame.

That left him continuing to cover for that conspiracy even after Trump took office — playing along with the “intelligence briefing” charade that led to the publication of the Steele Dossier’s most salacious lies about Trump as well as deceiving the president about whether he was the actual target of the entire investigation.

It’s clear Comey convinced himself he was completely justified and honorable, each mis­step of the way. By the time he was fired, he’d lost all perspective — so that a man whose job had long involved tracking down illegal leakers opted to turn leaker himself.

If he weren’t still so incredibly full of himself, he’d be a fit object of pity.