Last summer, Christopher Krebs, the government’s top election security official, began rebutting President Donald Trump’s baseless claims about the danger of massive election fraud. This week he got fired for standing his ground. Bravo for that.

America needs more profiles in courage like this to ensure that a defeated Trump vacates the White House on Jan. 20. Trump is an opportunist. He knows his lease on power expires in two months, but as in his business career, he’ll keep bargaining and threatening to rewrite the deal until the last hour. Trump’s problem, in this case, is that the agreement he’s trying to evade is the U.S. Constitution.

Krebs’ story is a case study in how responsible officials who work for Trump can resist being manipulated. As director of the Cybersecurity and Infrastructure Security Agency, or CISA, his job was to coordinate security for the 2020 elections. In the beginning, the main threat seemed to be from abroad – adversaries such as Russia, China and Iran. But it turned out that the real danger was at home, in false allegations from Trump and his supporters.

As Trump spun his lies about mail-in fraud, Krebs countered with facts. He created a “Rumor Control” site to rebut some of the wild charges. Example: “Rumor: A malicious actor can easily defraud an election by printing and sending in extra mail-in ballots,” topped by: “Reality: Safeguards are in place to prevent home-printed or photocopied mail-in ballots from being counted.”

CISA also posted a detailed checklist of “election integrity safeguards” for state and local election officials to ensure that mail-in votes were received and counted accurately. These practical steps helped create the reliable vote counts that Trump is now trying so hard to challenge, without success.

Krebs told me in August that contrary to Trump’s scaremongering, mail-in voting would be slow but solid. “Election Day may look different than you’ve seen in the past, and with more Americans voting absentee, it will take longer to tabulate and report complete results,” he said. He stressed that the right response was patience and reliance on trusted information.

Trump supporters tried to undercut CISA’s fact-checking. According to a CISA official, the White House, furious about the agency’s debunking of the mail-in fraud allegations, told CISA to remove some content from its Rumor Control site. But it’s still intact.

FBI Director Christopher Wray joined the effort to rebut Trump’s false claim that absentee voting could lead to massive fraud. “We have not seen, historically, any kind of coordinated national voter fraud effort in a major election, whether it’s by mail or otherwise,” Wray told a Senate committee in September.

As Trump supporters began spinning phony charges about rigged election software, CISA challenged the assertions. It provided a classified briefing in October for equipment companies and other vendors “in our shared effort to keep the nation’s elections secure and resilient.”

And when Trump and his acolytes cranked up a campaign alleging that a company called Dominion Voting Systems had stolen millions of votes, Krebs posted a prompt rebuttal. “There is no evidence that any voting system deleted or lost votes, changed votes, or was in any way compromised,” CISA said in a statement.

This last piece of truth-telling got Krebs fired, but for the country, it was an invaluable service. Before his ouster, Krebs’ agency, working with the FBI and state and local election authorities, had created a record that should be strong enough to withstand the barrage of attacks from Trump supporters who want to reverse the election outcome. This evidence shows that, as CISA and a coalition of other election officials said last week, the 2020 election “was the most secure in American history.”

The moral of this story is that officials can protect the country – if they show some backbone. Emily Murphy, the head of the General Services Administration, could begin a proper transition process now, if she mustered the courage.

Robert O’Brien, the national security adviser, could check the machinations of the team Trump has installed at the Pentagon after firing Defense Secretary Mark Esper, if he put the country first. Senate Majority Leader Mitch McConnell could reduce the ruin Trump has brought the GOP if he recognized President-elect Joe Biden’s victory.

Trump, the great disrupter, can survive in power only by creating such a tempest at home or abroad that he has a pretext to cling to power as commander in chief. But this outrage cannot happen unless good people let him get away with it.

Message for public officials: Be like Krebs.

Contact David Ignatius on Twitter @IgnatiusPost

Contact David Ignatius on Twitter @IgnatiusPost