MORE THAN the details of the case, President Trump’s tweet early Saturday celebrating the firing of former FBI deputy director Andrew McCabe is what stands out: a marquee of bullying and unseemly behavior by a president. Mr. Trump acts like a nasty, small-minded despot, not the leader of a democracy more than two centuries old in which rule of law is a sturdy pillar. If there is doubt that the timing of Mr. McCabe’s dismissal was driven by political vengeance, Mr. Trump does everything he can to prove the worst with his own sordid words.

This is the language of a banana republic. In nations without a strong democratic foundation, tyrants cling to power by belittling perceived enemies and insulting and coopting other institutions, such as a free press, law enforcement and the military, coercing them into subservience. Just look around the world at practices today in Azerbaijan, Cambodia and Turkey, to name a few. The banana republic playbook has no place in the United States, not in a town hall, not in a statehouse, least of all in the Oval Office.

Mr. McCabe is a 21-year-veteran of the FBI and served as deputy director under James B. Comey, whom Mr. Trump fired earlier. A Justice Department inspector general’s report, not yet public, reportedly found that he authorized the disclosure of sensitive information to the media about an investigation involving Hillary Clinton and then misled investigators. He disputes the allegations, noting that he had authority to share the information and corrected what he told investigators. He previously stepped down from the deputy director’s job and was preparing to retire from the FBI on Sunday, which would have assured him of a full federal pension. The rushed timing of the firing on Friday night by Attorney General Jeff Sessions — whose own job security is perpetually threatened by Mr. Trump — robs Mr. McCabe of that full pension.

As Mr. Trump knows, special counsel Robert S. Mueller III has been reported to be looking into possible obstruction of justice in the firing of Mr. Comey. Mr. McCabe could be a vital witness in such a prosecution. Now the president has attempted to discredit, and lauded the punishment of, a potential witness against him, an affront to the integrity and independence of law enforcement.

Mr. McCabe’s actions as deputy FBI director are hard to evaluate without release of the inspector general’s report, due out this spring. There will be time to judge him then. What is clear today is that the president jumped on Mr. McCabe with unseemly ferocity, tweeting: “Andrew McCabe FIRED, a great day for the hard working men and women of the FBI — A great day for Democracy.”

In fact, the hardworking men and women of the FBI, the Justice Department, the intelligence agencies and elsewhere in government come to work every day to uphold the values of a democratic system based on rule of law — a system that is distinguished by the simple principle that everyone is judged fairly, not by grudge or whim, and that no one is above the law, not even the president.