The three top federal agencies responsible for protecting the nation — the Departments of Justice, Defense and Homeland Security — are all being run by acting officials, as the United States endures one of its most sensitive national security crises.

The leadership vacuum is the product of President Trump’s tempestuous relationships with his Cabinet secretaries and tendency to replace them for long periods of time with acting officials who lack Senate confirmation — a pattern that has led to turmoil atop critical federal agencies for much of his presidency.

Never has the absence of confirmed leaders seemed more pronounced than now. All three agencies were being led by acting officials in the run-up to the Jan. 6 riot at the Capitol, where extremist Trump supporters who embrace the president’s false claims of election fraud stormed the building to demand that lawmakers dispute President-elect Joe Biden’s victory during a pro forma certification of the electoral college vote.

The events left five people dead, prompted the second impeachment of Trump in just over a year and raised serious questions about how the federal government failed to prepare for threats that in many cases were broadcast openly online. Now the agencies are playing critical roles in high-stakes preparations for the Jan. 20 inauguration in an environment of increased security threats.

When acting officials run critical agencies, they have reduced standing at the White House, according to former top officials, who say that can preclude uncomfortable but necessary discussions with the president.

“One of the central roles of a Cabinet secretary is to provide the president with advice that he needs to hear but doesn’t want to hear, but if they are all walking on inch-thin ice, they are all afraid to do that,” said Jeh Johnson, who served as President Barack Obama’s second homeland security secretary. “Especially now, with only a few days left in the Trump administration, everyone has been distracted. No one was looking at the emerging crisis right in their midst.”

Acting Attorney General Jeffrey A. Rosen on Jan. 12 strongly condemned the U.S. Capitol attack, adding that the "wrongdoers will be held responsible." (The Justice Department)

The makeshift leadership at the three agencies comes as Biden risks starting his presidency without any of his Cabinet nominees confirmed. In the recent past, the Senate has tried to confirm at least a few critical nominees immediately, so the president has some officials in place in the event of a crisis. The last president to begin his tenure without any of his nominees confirmed on his first day was George H.W. Bush, who took office in 1989, according to the Center for Presidential Transition.

In a letter on Tuesday, Senate Minority Leader Charles E. Schumer (D-N.Y.), who is poised to take over as majority leader on Jan. 20, said the riot demonstrated that the Biden administration will need Senate-confirmed officials in key national security Cabinet posts on Day One.

The Biden transition team said in a statement Wednesday that the confirmation hearing for Alejandro Mayorkas, Biden’s choice to run the Department of Homeland Security, had been moved up in the aftermath of the riot. The Biden team called for “swift hearings and confirmations” and said it is “focused on laying the groundwork for a smooth handoff in power.”

“If Wednesday didn’t underscore the importance of security in this country and the collaboration of Homeland Security, DoJ and DoD, I guess nothing in immediate memory will,” said Tom Ridge, who served as President George W. Bush’s secretary of homeland security. “It should cut through the nonsense, cut through the rhetoric and accelerate the confirmation of the president-elect’s security team.”

The confirmation hearing for Mayorkas was moved up to Jan. 19 after four former homeland security secretaries, including Johnson and Ridge, wrote an op-ed in The Washington Post saying the country couldn’t afford one more day without a confirmed DHS secretary.

“We need to return to regular order. We need to get the nominees confirmed. They need to get in there,” said Janet Napolitano, Obama’s first homeland security secretary and one of the four authors.

The Trump administration’s acting leaders at the Justice Department, the Pentagon and DHS have all faced scrutiny of their agencies’ preparations ahead of the riot.

At the Justice Department, acting attorney general Jeff Rosen and FBI Director Christopher A. Wray in particular have been criticized for not doing more to articulate the threat.

A day before the riot, an FBI office in Virginia had warned in an internal advisory that extremists were preparing to commit violence at Capitol. The FBI has insisted that the information was briefed to its Washington Field Office and a Joint Terrorism Task Force —which includes representatives from local and federal law enforcement agencies — but the warning apparently did not generate enough alarm for the FBI or the Justice Department to take more aggressive measures to help secure the Capitol.

FBI officials said Wray was not briefed on the Norfolk document in particular, because it was considered a raw intelligence product more appropriate for consideration by officials on the ground, and investigators had not identified particular people behind the threats. But Wray was briefed more broadly on threats his agents were seeing online and information that FBI sources were passing on about possible extremists traveling to the Capitol, the officials said.

It is unclear whether Rosen was told in advance of the document. Steven M. D’Antuono, the head of the FBI’s Washington Field Office, had claimed in the days after the riot that the FBI did not have information beforehand saying anything other than that a rally was planned.

The Justice Department took other steps that indicated that officials were at least somewhat aware of possible violence on Jan. 6. That week, the Bureau of Prisons took the unusual move of sending 100 officers to D.C. to supplement security at the Justice Department building. Officials have said the FBI set up two command posts in D.C., and agents visited some suspected extremists to investigate them or discourage them from traveling to Washington.

Mindful of the criticism they faced for their heavy-handed approach to racial justice protests in June, Justice Department officials deferred to the Capitol Police, which reports to Congress, to defend their building and lawmakers there — a responsibility that falls outside the department’s direct purview.

“It would not have been enough for the bureau simply to share information, if it did so, with state and local law enforcement or federal partner agencies,” said David Laufman, a former Justice Department national security official. “It was the bureau’s responsibility to quarterback a coordinated federal response.”

He added: “There should have been, as quickly as possible, a press conference where the attorney general of the United States and the FBI director stood shoulder to shoulder and gave a full-throated denunciation.”

Justice Department spokesman Marc Raimondi said Rosen has directed the agency to share with the public the response to the Capitol attack quickly and transparently. In addition to several public statements, Raimondi said, Rosen “directed that the FBI and U.S. attorney’s office overseeing the investigation to share information with Congress and to regularly brief the public through press conferences and other media availabilities to address the progress that the department is making in holding the attackers accountable.”

The Pentagon also has faced blowback over accusations that its leaders didn’t send the D.C. Guard to the Capitol fast enough upon receiving urgent requests from city officials and the Capitol Police. The Defense Department has said the Capitol Police declined offers for Guard backup ahead of the Jan. 6 event and didn’t make a plan with the military in advance, so the Guard wasn’t positioned to respond urgently to an insurrection at the building.

Army Secretary Ryan C. McCarthy, who was confirmed by the Senate and played a leading role in the preparations, denied that loyalty to Trump at the Pentagon played any role in the speed with which the Guard responded to the riot. McCarthy told The Post in an interview Tuesday that the military moved as fast as possible “from a cold start,” having not prepared a contingency to respond to such an incident because the Capitol Police had not requested military assistance in advance.

The reasons for the absence of leaders confirmed to their positions atop the Pentagon, the Justice Department and DHS ahead of the riot are varied — but they all trace back to Trump’s habit of dismissing Cabinet secretaries, often when he has felt they were not supporting his political agenda.

Acting defense secretary Christopher C. Miller, a former top counterterrorism official, took the helm of the Pentagon in November after Trump fired Mark T. Esper in the days after the election. Trump had grown angry with Esper because of his opposition to the deployment of active-duty troops in response to racial justice protests in Washington last year.

Rosen has been running the Justice Department since last month, when William P. Barr resigned. Barr had been one of Trump’s most loyal foot soldiers before the president turned on him when he didn’t announce investigations of Trump’s political foes and disputed White House claims of widespread election fraud.

DHS, which oversees the Secret Service, the main agency leading security preparations for Biden’s inauguration, has been in leadership turmoil for months. The department has not had a Senate-confirmed chief since Trump ousted Kirstjen Nielsen in April 2019.

Chad Wolf’s sudden resignation Monday after serving 14 months as acting homeland security secretary has deepened the turmoil at the sprawling agency, which was established after the attacks of Sept. 11, 2001, with a basic mission of projecting an aura of government competence and stability.

In a statement to DHS staff members Monday, Wolf attributed his decision to step down to “recent events” and court rulings challenging his authority to implement new policies on the grounds that his appointment violated federal vacancy rules.

Under the George W. Bush and Obama administrations, DHS secretaries remained in their jobs for years. Under Trump, the department has had unprecedented turnover at its highest levels, as well as multiple prolonged vacancies in other senior positions. Career officials at the department have repeatedly expressed frustration about the White House’s improvisational management of DHS, characterized by sudden firings and a flagrant disregard for the norms of the Senate confirmation process.

Wolf was replaced as acting secretary on Tuesday by Federal Emergency Management Agency Administrator Peter Gaynor. Gaynor is the sixth person the president has installed to run DHS, a department that has had only six other leaders in the 14 years before Trump.

One senior DHS official who works with Gaynor applauded the move and described him as the right choice for the short but potentially challenging leadership assignment. “He’s perfect,” said the official, who was not authorized to speak to reporters. “What we need most for the next 10 days is an emergency manager.”

Lawmakers have expressed frustration and dismay about the lack of a DHS role before or during the mob attack on the Capitol. Dozens of armed DHS personnel from Customs and Border Protection had been put on standby ahead of the event and were stationed at the Reagan Building but were not deployed to the Capitol, according to a CBP official. The Capitol Police must formally request help for federal forces to enter the building.

Johnson said DHS’s Office of Intelligence and Analysis, known as I&A, appears to have failed to warn about the threat. “If the government is functioning properly, then the Department of Homeland Security should be the centerpiece of all of this,” Johnson said.

The office was designed to promote intelligence sharing across government. It was heavily criticized last summer for gathering open-source intelligence on sometimes-violent protesters in Portland.

Brian Murphy, a former head of the office who was removed by Wolf last summer, filed a whistleblower complaint in September alleging that he was urged to make changes to a threat assessment report examining public safety risks from domestic extremists, including right-wing groups.

The complaint alleges that second-ranking DHS official Ken Cuccinelli asked Murphy during several meetings in May and June to modify a section of his report on white supremacy “in a manner that made the threat appear less severe, as well as include information on the prominence of violent ‘left-wing’ groups,” the complaint states.

DHS “has produced numerous intelligence reports highlighting the heightened threat environment during the 2020-2021 election season, including the extent to which the political transition and political polarization are contributing to the mobilization of individuals to commit violence,” the department said in a statement. “To the extent press reports suggest that I&A did not believe events such as the certification of the electoral college in effect presented a heightened threat environment, they are incorrect.”

But a DHS spokesperson confirmed to NPR that its I&A office didn’t produce any threat assessment specifically about the possibility of violence on Jan. 6.

Security for the inauguration will be run by the Secret Service, a DHS agency, and will be designated a National Special Security Event, which will ensure a high level of preparation. One of Wolf’s final moves as acting secretary was to place the Secret Service in charge of security coordination starting Wednesday, rather than Jan. 19, as originally planned.

DHS said in a statement that the Secret Service “has been working for years to make sure this inauguration is safe and secure.” As many as 20,000 National Guard troops could be in the city for the event, the acting chief of police for the District said Wednesday.

“One of the things the federal government does well is after there has been a failure, they overcorrect,” Johnson said. “My guess is there are going to be massive levels of security at the inauguration. It is probably going to be the case that a chipmunk will not be able to penetrate the U.S. Capitol grounds without going through a metal detector.”