Once again, President Donald Trump has tried to meddle improperly with the federal justice system. Once again, he has failed. The pattern is a consistent one — and tells a more hopeful story than might be expected.

Late at night on June 19, Attorney General William Barr announced that Geoffrey Berman, the U.S. attorney for the Southern District of New York, was stepping down. A short time later, Berman said he was doing no such thing, implied that Barr was exceeding his authority and effectively forced the attorney general to get the president’s own say-so on the matter the next day. Trump’s preferred replacement was blocked from immediately taking office and Berman’s deputy took the helm.

What was the objective of this ploy? To put it mildly, there are grounds to suspect the president’s motives. The Southern District once prosecuted Trump’s fixer for paying hush money to some of his former paramours. According to news reports, it is currently investigating whether his personal attorney, Rudy Giuliani, tried to illegally lobby on behalf of a foreign government; expansive financial misconduct suspected on the part of his inaugural committee; and potential money-laundering by his son-in-law’s family real-estate company. That’s not to mention the 12 criminal referrals from special counsel Robert Mueller’s investigation that haven’t yet been publicly revealed and may have been handed to the office.

If the president was minded to act corruptly, then, he certainly had his reasons.

Even setting aside such suspicions, Barr’s action is perplexing. If Berman had been performing poorly on the job, then why offer him a high-ranking position within the Justice Department, as Barr says he did? If the president felt that Berman — a Republican and former Trump donor — was out to embarrass him politically, as he has hinted, then why not say so and fire him overtly? Any charitable interpretation also must account for the fact governments rarely announce their most defensible decisions late on a Friday night.

There is, however, some good news. Whether conceived in malevolence or mere incompetence, the effort failed. Trump was forced to do the deed himself, despite his obvious reluctance. All of the office’s investigations are still proceeding under Berman’s interim successor. Even Sen. Lindsey Graham, R-S.C., the Trump stalwart who heads the judiciary committee, has emphasized that the nomination of Berman’s replacement will move forward as normal, and not be fast-tracked as Trump might wish. Any hopes of a late-night power play to get the president’s man in position have been humiliatingly dashed.

Nor is this the first such disappointment for Trump. Time and again, he has tried to wield his powers corruptly. Time and again, his plots have come undone. So it went with his attempts to derail Mueller’s probe, strong-arm Ukraine, obstruct the investigation of a Turkish bank, furtively alter the census, and on and on. Recently, his administration was demanding that a judge stop the publication of former national security adviser John Bolton’s memoir, in an appalling affront to free speech. That one backfired too: The book is now a bestseller.

What do all these failed machinations have in common? Corrupt intent and ham-handedness, to be sure. But each also demonstrates that the American constitutional system is working. The courts have thwarted Trump’s unlawful schemes and jailed his associates. Congress, despite occasional pliancy, has overridden the president’s worst ideas, refused to confirm his inept nominees and completely ignored his ill-advised budget requests, not to mention impeached him. Within the executive branch, whistle-blowers have exposed misconduct, bureaucrats have impeded abuses of power, and a bevy of officials have resigned to protest Trump’s misguided or unethical actions. Through it all, a free press has exposed the administration’s misdeeds on a near-daily basis.

No normal president would have put the system under so much stress. Trump has tested it severely — but so far, at least, the system has prevailed. With the president’s first term winding down, and his influence eroding by the day, Americans should be thankful for that.

— Bloomberg News