President Trump is stepping up his war on the federal government after losing the 2020 election, sending heads rolling across key agencies with a late push to get personnel and policies in place before he leaves the White House.

The president’s dismissal of Defense Secretary Mark Esper and other top Pentagon officials put Washington on notice and potentially paved the way for the withdrawal of U.S. troops from the nation’s longest-running war in Afghanistan.

Rumors are swirling around whether CIA Director Gina Haspel might be next, as the president’s allies accuse her of obstructing efforts to declassify top-secret materials they say would expose wrongdoing in the Russia investigation.

A shake-up is underway at the Department of Homeland Security’s (DHS) cyber division, where top officials have disputed Trump’s baseless claims that Democrats fraudulently stole the election from him.

The president has installed loyalists at agencies responsible for overseeing the government’s environmental and energy regulations, and there is speculation that he could clean house at the FBI or Health and Human Services.

Trump has long been frustrated by what he views as entrenched government bureaucrats working behind the scenes to block his agenda.

With President-elect Joe Biden set to be sworn in on Jan. 20, Trump’s allies say the president has nothing to lose and is on the warpath against the government officials he thinks are standing in the way of the final policies he hopes to achieve.

“The deep state is on the run,” said Bryan Lanza, an adviser to Trump’s 2016 presidential transition team. “This is about closing out the things he was told he shouldn’t touch. For three years and nine months Trump was responding to the deep state. Now Trump is unleashed, and the deep state is responding to him.”

Current and former Washington officials are watching with alarm, worried about what they view as Trump’s erratic behavior and the potential for unforeseen developments that could have national security consequences at a time of deep unrest and confusion.

Trump’s refusal to concede to Biden is adding to the sense of unease. Biden has not received government intelligence briefings, as is customary. Millions of Americans believe the election was stolen from Trump.

“Causing chaos may be Trump’s highest priority,” said Dov Zakheim, an undersecretary of Defense in former President George W. Bush’s administration. “He doesn’t want anyone in position to help Biden’s transition. You need government holdovers who can assist the new people coming in. He’s causing disruption and making that transition very difficult.”

Trump’s purge at the Pentagon might be the most consequential move he makes in the lame-duck period, both for his legacy and for the U.S. presence in the Middle East.

Acting Defense Secretary Christopher Miller has been a critic of the war in Afghanistan. The president has talked about how he wants to see a full withdrawal from that conflict, which has been going on since 2001.

“If he doesn’t pull troops out of Afghanistan now then none of these moves will have made any sense,” said a Republican close to the White House. “The president’s supporters want him to bring our troops home, and the American people are more than ready for it. There could be no better capstone for the president’s legacy than to be the man who ended America’s longest-fought war.”

Jen Psaki, Biden’s transition spokeswoman, criticized Esper’s firing, saying that “it’s a concern to see the upheaval because there shouldn’t be the politicization of the military.”

National security experts are worried about the prospect of newly installed, formerly junior Defense officials executing a high-stakes military withdrawal under a tight deadline and political pressure in an unstable region.

They say Miller’s civilian resume is extremely light on leadership experience. And they say Trump has filled other recent vacancies he created with partisan loyalists, such as retired Army Col. Douglas Macgregor, a frequent commentator on Fox News.

“He’s going after his enemies list and canning anyone who has ever crossed him or perceived to have crossed him, and by kicking those people out, he can reward his most slavish loyalists or elevate people who are unqualified,” said Zakheim.

At the CIA, Trump’s allies are privately confident that Haspel will be forced out, although there is a fierce behind-the-scenes struggle over her fate.

Republicans close to the White House, including Trump’s eldest son, Donald Trump Jr., have publicly advocated for Haspel’s dismissal. They believe she’s blocking Trump from declassifying explosive documents that would recast the Russia narrative by exposing government malfeasance in the investigation.

Sen. John Cornyn (R-Texas) is against the declassification, saying it would reveal sensitive information about U.S. intelligence gathering.

“Intelligence should not be partisan,” Cornyn tweeted. “Not about manipulation, it is about preserving impartial, nonpartisan information necessary to inform policy makers and so they can protect the U.S.”

But the declassification is personal for some in Trump’s inner circle who feel their lives were upended and freedom jeopardized by the three-year investigation into Russian collusion.

“The incalculable damage done to the public trust by the abuse and corruption of our criminal justice system by the Russia hoax requires all of the sunshine we can muster and far outweighs the disclosure of any intelligence techniques,” said John Dowd, Trump’s top attorney in the special counsel investigation.

GOP critics say that beyond revealing national security secrets, firing Haspel and other top national security officials is bad politics that will blow back on Republicans at a time when they’re trying to win special elections in Georgia that will determine the balance of power in the Senate.

“This is the kind of conduct that will come back not just to tarnish Trump’s legacy — that’s easy to see — but to tarnish the party and its candidates as well,” John Bolton, Trump’s former national security adviser, said on NPR.

Elsewhere, Christopher Krebs, the nation’s top cybersecurity official, has been telling people he believes he’ll be fired by the White House.

There are reports that several other officials at the DHS’s Cybersecurity and Infrastructure Security Agency (CISA) are stepping down or being forced to resign.

Krebs’s team has been running a “rumor control” page to beat back disinformation around the election, including allegations that it was stolen from Trump through fraud.

Late Thursday, CISA released a statement saying there is no evidence that “any voting system deleted or lost votes, changed votes, or was in any way compromised.”

Democrats are furious over Trump’s moves at CISA and the rumors about further firings.

“This is dangerous,” said Rep. Bennie Thompson (D-Miss.), the chairman of the Committee on Homeland Security. “The president’s refusal to put country before ego is a national security threat.”

Read more at The Hill