WASHINGTON -- Three days before supporters of U.S. President Donald Trump rioted at the Capitol, the Pentagon asked the U.S Capitol Police if it needed National Guard manpower. And as the mob descended on the building Wednesday, Justice Department leaders reached out to offer up FBI agents. The police turned them down both times, according to senior defence officials and two people familiar with the matter.

Despite plenty of warnings of a possible insurrection and ample resources and time to prepare, the Capitol Police planned only for a free speech demonstration.

Still stinging from the uproar over the violent response by law enforcement to protests last June near the White House, officials also were intent on avoiding any appearance that the federal government was deploying active duty or National Guard troops against Americans.

The result is the U.S. Capitol was overrun Wednesday and officers in a law enforcement agency with a large operating budget and experience in high-security events protecting lawmakers were overwhelmed for the world to see. Four rioters died, including one shot inside the building. A Capitol Police officer died Thursday after being injured in the Wednesday melee.

The rioting and loss of control has raised serious questions over security at the Capitol for future events. The actions of the day also raise troubling concerns about the treatment of mainly white Trump supporters, who were allowed to roam through the building for hours, while Black and brown protesters who demonstrated last year over police brutality faced more robust and aggressive policing.

"This was a failure of imagination, a failure of leadership," said Houston Police Chief Art Acevedo, whose department responded to several large protests last year following the death of George Floyd. "The Capitol Police must do better and I don't see how we can get around that."

Acevedo said he has attended events on the Capitol grounds to honour slain police officers that had higher fences and a stronger security presence than what he saw on video Wednesday.

Army Secretary Ryan McCarthy said that as the rioting was underway, it became clear that the Capitol Police were overrun. But he said there was no contingency planning done in advance for what forces could do in case of a problem at the Capitol because Defence Department help was turned down. "They've got to ask us, the request has to come to us," said McCarthy.

U.S. Capitol Police Chief Steven Sund, under pressure from Schumer, Pelosi and other congressional leaders, was forced to resign. Senate Majority Leader Mitch McConnell asked for and received the resignation of the Sergeant at Arms of the Senate, Michael Stenger, effective immediately. Paul Irving, the longtime Sergeant at Arms of the House, also resigned.

"There was a failure of leadership at the top," House Speaker Nancy Pelosi said.

The U.S. Capitol had been closed to the public since March because of the COVID-19 pandemic, which has now killed more than 360,000 people in the U.S. But normally, the building is open to the public and lawmakers pride themselves on their availability to their constituents.

It is not clear how many officers were on-duty Wednesday, but the complex is policed by a total of 2,300 officers for 16 acres of ground who protect the 435 House representatives, 100 U.S. senators and their staff. By comparison, the city of Minneapolis has about 840 uniformed officers policing a population of 425,000 in a 6,000-acre area.

There were signs for weeks that violence could strike on Jan. 6, when Congress convened for a joint session to finish counting the Electoral College votes that would confirm Democrat Joe Biden had won the presidential election.

On far-right message boards and in pro-Trump circles, plans were being made.

The leader of the far-right extremist group Proud Boys was arrested coming into the nation's capital this week on a weapons charge for carrying empty high-capacity magazines emblazoned with their logo. He admitted to police that he had made statements about rioting in Washington, local officials said.

Both Acevedo and Ed Davis, a former Boston police commissioner who led the department during the 2013 Boston Marathon bombing, said they did not fault the responses of clearly overmatched front-line officers, but the planning and leadership before the riot.

"Was there a structural feeling that well, these are a bunch of conservatives, they're not going to do anything like this? Quite possibly," Davis said. "That's where the racial component to this comes into play in my mind. Was there a lack of urgency or a sense that this could never happen with this crowd? Is that possible? Absolutely."

Trump and his allies were perhaps the biggest megaphones, encouraging supporters to turn out in force and support his false claim that the election had been stolen from him. He egged them on during a rally shortly before they marched to the Capitol and rioted. His personal attorney Rudy Giuliani, a former New York mayor known for his tough-on-crime stance, called for "trial by combat."

McCarthy said law enforcement's intelligence estimates of the potential crowd size in the run-up to the riot "were all over the board," from a low of 2,000 to as many as 80,000.

So the Capitol Police had set up no hard perimeter around the Capitol. Officers were focused on one side where lawmakers were entering to vote to certify Biden's win.

Barricades were set up on the plaza in front of the building, but police retreated from the line and a mob of people broke through. Lawmakers, at first unaware of the security breach, continued their debate. Soon they were cowering under chairs. Eventually they were escorted from the House and Senate. Journalists were left alone in rooms for hours as the mob attempted to break into barricaded rooms.

Sund, the Capitol Police chief, said he had expected a display of "First Amendment activities" that instead turned into a "violent attack." But Gus Papathanasiou, head of the Capitol Police union, said planning failures left officers exposed without backup or equipment against surging crowds of rioters.

"We were lucky that more of those who breached the Capitol did not have firearms or explosives and did not have a more malign intent," Papathanasiou said in a statement. "Tragic as the deaths are that resulted from the attack, we are fortunate the casualty toll was not higher."

The Justice Department, FBI and other agencies began to monitor hotels, flights and social media for weeks and were expecting large crowds. Mayor Muriel Bowser had warned of impending violence for weeks, and businesses had closed in anticipation. She requested National Guard help from the Pentagon on Dec. 31, but the Capitol Police turned down the Jan. 3 offer from the Defence Department, according to Kenneth Rapuano, assistant defence secretary for homeland security.

"We asked more than once and the final return that we got on Sunday the 3rd was that they would not be asking DOD for assistance," he said.

The Justice Department's offer for FBI support as the rioters grew violent was rejected by the Capitol Police, according to the two people familiar with the matter. They were not authorized to publicly discuss the matter and spoke on condition of anonymity.

By then, it was too late.

Officers from the Metropolitan Police Department descended. Agents from nearly every Justice Department agency, including the FBI, were called in. So was the Secret Service and the Federal Protective Service. The Bureau of Alcohol, Tobacco, Firearms and Explosives sent two tactical teams. Police from as far away as New Jersey arrived to help.

It took four hours to evict the rioters from the Capitol complex. By then, they had roamed the halls of Congress, posed for photos inside hallowed chambers, broken through doors, destroyed property and taken photos of themselves doing it. Only 13 were arrested at the time; scores were arrested later.

In the aftermath, a 7-foot fence will go up around the Capitol grounds for at least 30 days. The Capitol Police will conduct a review of the carnage, as well as their planning and policies. Lawmakers plan to investigate how authorities handled the rioting.

The acting U.S. attorney in the District of Columbia, Michael Sherwin, said the failure to arrest more people is making their jobs harder.

"Look, we have to now go through cell site orders, collect video footage to try to identify people and then charge them, and then try to execute their arrest. So that has made things challenging, but I can't answer why those people weren't zip-tied as they were leaving the building by the Capitol Police."

------

Associated Press writers Ben Fox, Mary Clare Jalonick, Andrew Taylor and Ashraf Khalil contributed to this report.