CNN  — 

President Donald Trump on Tuesday fired the Department of Homeland Security official who had rejected Trump’s claims of widespread voter fraud.

Trump announced on Twitter he was firing Chris Krebs, the director of the Cybersecurity and Infrastructure Security Agency, and directly tied it to Krebs’ statement that said there “is no evidence that any voting system deleted or lost votes, changed votes, or was in any way compromised.”

“The recent statement by Chris Krebs on the security of the 2020 Election was highly inaccurate, in that there were massive improprieties and fraud,” Trump said in a tweet that also repeated other baseless conspiracy theories about the election and was flagged by Twitter as “disputed.”

“Therefore, effective immediately, Chris Krebs has been terminated as Director of the Cybersecurity and Infrastructure Security Agency.”

RELATED: CNN’s live presidential election results

CNN reported that Krebs, who ran the cyber arm of the Department of Homeland Security, expected to be fired. A source close to Krebs told CNN he knew he might get in trouble for telling the truth, but realized his dismissal could come soon when media organizations that are friendly to the President started to attack him.

He learned from Trump’s tweet he had been fired, the source said, and responded on Twitter himself shortly afterward, saying, “Honored to serve. We did it right. Defend Today, Secure Tomrorow. #Protect2020.”

CISA Deputy Director Matt Travis, the No. 2 official at the agency, resigned in the wake of Krebs’ firing, a source familiar with the matter told CNN. Travis resigned after the White House made clear he would not take the helm at CISA.

In a letter seen by CNN, CISA’s chief of staff Emily Early informed the staff that Tuesday was Krebs’ last day with the agency, and said the President has designated Executive Director Brandon Wales as acting director.

“A change in leadership is not a change in mission and it is essential that we do not lose focus on the important work we collectively undertake on behalf of the American people,” the letter stated. “Fortunately, we have the best workforce in all of government and I know we can count on each of you to continue the excellent work you do every day as we all work together to Defend Today and Secure Tomorrow.”

A source described Wales as a “career former chief of staff, and counselor, who is highly respected by everyone.”

Krebs’ dismissal underscores the lengths Trump is willing to go to punish those who don’t adopt his conspiratorial view of the election. Since CNN and other outlets called the race for President-elect Joe Biden, Trump has refused to accept the results, instead pushing baseless conspiracies that his second term is being stolen.

This includes falsely claiming during an election night address that he had already won reelection, that he had won states that were actually still up in the air at the time and that his opponents were perpetuating a fraud.

In the lead-up to the election, Krebs had often quietly disputed the President’s repeated false claims about mail-in ballots but went out of his way to not get drawn into criticizing his boss for spreading lies.

But in the days that have followed, Krebs has adopted a more forceful approach regularly posting on Twitter – often with blaring red siren emojis – fact checks of the claims and conspiracy theories being pushed by Trump, his allies and supporters around the country.

While his pushback at the President’s falsehoods had frustrated some at DHS, Krebs was responsible for a widely praised revamp of the department’s cybersecurity efforts and increasing coordination with state and local governments, as the first director of CISA.

He served as one of the most key federal national security officials that oversaw an election that by all accounts went very smoothly.

Foreign adversaries were not able to affect any of the votes, CISA said, and it was “the most secure election in American history,” according to them and the wider group of public and private election officials. That was the statement for which the President decided to fire Krebs on Tuesday evening.

News of his dismissal drew quick outrage from elected officials and election security experts.

Sen. Angus King, an independent from Maine and co-chair of the Cyberspace Solarium Commission, said in a statement, “By firing Mr. Krebs for simply doing his job, President Trump is inflicting severe damage on all Americans – who rely on CISA’s defenses, even if they don’t know it.”

“If there’s any silver lining in this unjust decision, it’s this: I hope that President-elect Biden will recognize Chris’s contributions, and consult with him as the Biden administration charts the future of this critically important agency,” King said.

In one notably forceful rebuke, Rep. Adam Schiff, the Democratic chairman of the House Intelligence Committee, called Trump’s decision “pathetic.”

“Instead of rewarding this great service, President Trump is retaliating against Director Krebs and other officials who did their duty. It’s pathetic, but sadly predictable that upholding and protecting our democratic processes would be cause for firing,” Schiff said.

Former DHS general counsel John Mitnick, also blasted Krebs’ firing as “outrageous but not surprising.”

“@realDonaldTrump has made a habit of firing those who are highly competent, have integrity and courage, and stand up for the #RuleOfLaw. To @CISAKrebs: it was an honor to serve with you @DHSgov, and you should wear this as a badge of honor,” he tweeted.

Ben Hovland, a Trump appointee who is chairman of the US Election Assistance Commission, praised Krebs during an interview with CNN’s Erin Burnett on “OutFront” as a “great director” who “showed a lot of leadership, particularly in the election space.”

Asked about the President’s false claims of massive voter fraud, Hovland explained, “When you talk to election officials across the country, they’re confident in the security of this election. They’re confident in the outcome of the election – that this was a fair election and that Americans made their voices heard, and we’ve got to respect the will of the people and the public servants that helped run this election and make this all possible.”

Krebs’ firing also prompted some notable pushback from Republicans.

Ohio Sen. Rob Portman, a member of the Senate Homeland Security and Governmental Affairs Committee, defended Krebs’ work to CNN shortly after his dismissal.

“I know Chris. I’ve worked well with him. I think he’s a real professional,” the Republican said.

Asked if he wished Trump hadn’t fired Krebs, Portman said: “Yeah, I think he was very good. I think what he was trying to do in an unprecedented way was to connect with every state in the country, and give them what they needed to protect and have a firewall in place to protect against cyber attacks.”

Krebs kept up the fact check of the President’s conspiracy-mongering until the final hours of his tenure, tweeting earlier Tuesday that claims of manipulation of election systems “either have been unsubstantiated or are technically incoherent.”

He was quoting from a letter signed by 59 election specialists that also said that “anyone asserting that a US election was ‘rigged’ is making an extraordinary claim” and called them “alarming assertions.”

Firing Krebs, a US official previously told CNN, would “cross a red line” and set off alarm bells throughout the national security apparatus.

Marcus Fowler, a former CIA officer who now works as the director of strategic threat at the cybersecurity firm Darktrace, described Krebs to CNN as “a Dr. (Anthony) Fauci-like figure for election and cyber security, speaking truth to power about the security of the election based on the facts on the ground and the analysis of his subject matter experts.”

“His forced departure at this critical time will absolutely degrade our national security, sends a horrible message and exposes vulnerability to our adversaries, and puts the credibility of the core democratic value of voting at risk of being undermined, manipulated, and hijacked,” Fowler said.

Still, his dismissal comes after several of the Pentagon’s most senior civilian officials were replaced with officials perceived as loyal to the President, and reports of Trump’s increasing frustration with CIA Director Gina Haspel.

This story has been updated with additional developments on Tuesday.

CNN’s Jake Tapper, Vivian Salama, Jeremy Diamond, Manu Raju, Alex Marquardt, Geneva Sands and Zachary Cohen contributed to this report.