The refusal by Mr. Krebs and his agency to back up the president’s claims put him on a list of disloyal officials, Mr. Krebs believed, that included Mark T. Esper, who was fired as secretary of defense shortly after the election; Christopher A. Wray, the F.B.I. director; and Gina Haspel, the director of the C.I.A. Mr. Wray and Ms. Haspel remain in their jobs.
In recent weeks, Mr. Krebs drew the president’s ire again with his refusal to echo Mr. Trump’s conspiracy theories about software glitches and dead people voting. Quite the contrary: Within hours of Mr. Trump tweeting false reports that millions of Trump votes were deleted, Mr. Krebs joined election officials in calling the election “the most secure in American history.”
As of Tuesday, he was still scheduling public speaking engagements on behalf of his agency. On Wednesday, he was due to participate in two, including a fireside chat on “Foreign Interference and Election Meddling.”
Mr. Krebs did not immediately respond to requests for comment. But after his termination, he tweeted from his personal account: “Honored to serve. We did it right. Defend Today, Secure Tomrorow. #Protect2020.”
Alexei Woltornist, a spokesman for the Department of Homeland Security, said the agency had nothing to add to the president’s tweet.
Mr. Krebs had told friends he was planning to leave government after Mr. Trump’s term. Mr. Krebs has five young children and was running one of the fastest-growing agencies in the federal government, with a broad mandate to secure power plants, water systems and networks that were subject to relentless cyberattacks by criminals and foreign states. Until recently, members of the Trump administration often cited the agency’s progress and its innovations, as did some prominent Democrats. Last week, a parade of Silicon Valley executives praised his work in securing the election.
The day before the election, he had given briefings every few hours, describing how the usual tribulations of the day were being dealt with, and squelching rumors. “It’s just another Tuesday on the internet,” he said with a shrug when asked about some of the misinformation.