Almost two years ago, Attorney General William Barr came to office with long experience, a reputation for competence and an expansive view of presidential power. In the age of Donald Trump, that was a dangerous combination. As Barr leaves office this month, it's increasingly clear how much damage has been done.

Although Trump insists his attorney general did "an outstanding job," any fair reading of his record suggests otherwise. Some of his offenses could be called merely hardball politics. His public presentation of special counsel Robert Mueller's report — which detailed appalling wrongdoing on the president's part — was a master class in partisan spin, blurring the underlying misconduct amid a whirlwind of legalism and misdirection.

Other actions were more harmful. Heedless of the reputational damage to the Justice Department, Barr intervened in the prosecutions of Roger Stone (Trump's friend) and Michael Flynn (his former adviser), prompting protests and resignations. He abetted a scheme to investigate Trump's political opponents, which ultimately led to the president's impeachment.

Perhaps you recall his failed dead-of-night scheme to install new leadership at the U.S. attorney's office in New York's Southern District, just weeks before that very office indicted Trump's former campaign manager?

Again and again, Barr has prioritized Trump's preferences over principle. He pressured federal prosecutors — despite their misgivings — to antagonize companies that had displeased the president, resulting in mountains of needless paperwork, months of uncertainty and (in Google's case) a half-baked antitrust suit. He dropped politically inexpedient cases, intervened in the president's personal legal trouble, undermined whistleblowers and inspectors general, and facilitated Trump's unrestrained abuse of the pardon power.

One further incident stands out. Last summer, Barr personally ordered law-enforcement officers to remove peaceful protesters and clergy members outside the White House so the boss could stage a photo op at a nearby church.

The rare moments when Barr did the right thing — in refusing to indulge Trump's claims about a stolen election, for instance — only emphasized how far he had strayed from normal practice. In the end, he was the president's most effective enabler. No compliment intended.