WEDNESDAY’S ASSAULT on the U.S. Capitol, and on American democracy, was instigated and condoned by President Trump. He should be held to account, and the rioters themselves prosecuted. Yet accountability cannot end there, nor can preparation for a recurrence.

Top law enforcement officials and key members of Congress have said plainly what Americans could see — that the events Wednesday were enabled by a failure of law enforcement and a collapse of security at what President-elect Joe Biden called America’s “citadel of liberty.” To prevent another such failure, on Inauguration Day and subsequently, there must be a robust investigation of the causes for evident shortcomings in leadership, planning, intelligence, coordination and tactics.

The focus of that fact-finding will be the U.S. Capitol Police, the agency primarily responsible for protection of the Capitol and its grounds. In addition to their daily roles, police are sometimes faced with nearly unimaginable emergencies, yet in this case the Capitol Police were manifestly unprepared, despite abundant warnings of violence on social media and weeks of incitement by Mr. Trump. Appropriately, on Thursday, the Capitol Police chief, Steven Sund, said he would resign.

The 1,900-officer Capitol Police, massively outnumbered and lightly in evidence as the mob approached the Capitol, were almost instantly overrun at the building’s perimeter. Dozens of officers, including from the D.C. Metropolitan Police, were injured; one Capitol Police officer died. Given explicit advance signs of violence — even of an attempted assault on the Capitol itself — was there no blueprint for a worst-case scenario at one of the nation’s most sensitive, high-value potential targets? Why were the Capitol Police’s ranks so thin and their barriers so soft? What were their orders? Would greater use of tear gas, stun grenades and other crowd-control tactics have been effective? And was it justified for a Capitol Police officer to shoot and kill an unarmed woman at the door to the House chamber?

Another question is more political: Did the Trump administration’s obsession with antifa, and its distaste for Black Lives Matter, blind officials to the threat of an overwhelmingly White right-wing mob?

Officials were justifiably wary of re-creating last year’s tableaux of heavily armed law enforcement troops combating mainly peaceful protesters following George Floyd’s killing. But was it right to withhold all but a token, and unarmed, presence of National Guard members — most of them deployed at Metro stations and handling traffic — until events had spun completely out of control?

Authorities have now put up fencing and deployed more forces to prevent any repeat of the assault between now and Jan. 20. That’s only prudent. But longer-term measures must be carefully weighed. Americans have long enjoyed access to a Capitol building that has rightly seemed less a fortress than the people’s house. It must remain the people’s house — but one that is secure from insurrection.

Chief Sund, who issued a statement saying the assault at the Capitol “was unlike any I have ever experienced in my 30 years in law enforcement here in Washington D.C.,” has some questions to answer. The most important among them are: How did this happen, and, even after he departs, how can his agency avoid any repetition?

Read more: