As President Trump told a sprawling crowd outside the White House that they should never accept defeat, hundreds of his supporters stormed the U.S. Capitol in what amounted to an attempted coup that they hoped would overturn the election he lost. In the chaos, law enforcement officials said, one woman was shot and killed by Capitol Police.

The violent scene — much of it incited by the president’s incendiary language — was like no other in modern American history, bringing to a sudden halt the congressional certification of Joe Biden’s electoral victory.

With poles bearing blue Trump flags, a mob that would eventually grow into the thousands bashed through Capitol doors and windows, forcing their way past police officers unprepared for the onslaught. Lawmakers were evacuated shortly before an armed standoff at the House chamber’s entrance. The woman who was shot was rushed to an ambulance, police said, and later died. Canisters of tear gas were fired across the Rotunda’s white marble floor, and on the steps outside the building, rioters flew Confederate flags.

“USA! USA!” chanted the would-be saboteurs of a 244-year-old democracy.

The Senate stopped its proceedings, and the House doors were closed. In a notification, U.S. Capitol Police said no one would be allowed to come or go from the building as they struggled to regain control. “Stay away from exterior windows, doors. If outside, seek cover,” police warned.

All 1,100 members of the D.C. National Guard were activated, and Mayor Muriel E. Bowser (D) imposed a citywide curfew. From 6 p.m. Wednesday to 6 a.m. Thursday, Bowser said, no one other than essential personnel would be allowed outdoors in the city.

The mob had arrived hours earlier, charging past the metal barricades on the property’s outer edge. Hundreds, then thousands followed them. Some scaled the Capitol’s walls to reach entrances; others climbed over one another.

By day’s end, four people would be dead: one from gunfire and three from medical emergencies that officials have yet to explain.

On the building’s east side, police initially pushed the pro-Trump demonstrators back but soon gave up and fell back to the foot of the main steps. Within a half-hour, fights broke out again, and police retreated to the top of the stairs as screaming Trump supporters surged closer. After police perimeters were breached, the elated crowd began to sing the national anthem.

For an hour, they banged on the doors, chanting, “Let us in! Let us in!” Police inside fired pepper balls and smoke bombs into the crowd but failed to turn them away. After each volley, the rioters, who were mostly White men, would cluster around the doors again, yelling, arguing, pledging revolution.

Sometime after 2:10 p.m., a man used a clear plastic riot shield to break through the windows on a first floor to the south side of the building, then hopped in with a few others. Once inside, police suspect, rioters opened doors to let in more of their compatriots.

A Capitol Police officer yelled from a higher stairway at the intruders, ordering them to stop, but when they didn’t, the officer fired at a man coming at him, two law enforcement officials said. Amid shouts and people rushing to get away from the sound of gunfire, rioters saw a woman in their group collapse. Police believe she was unarmed, a law enforcement official said, but the officer who shot her did not know that. Capitol Police had already been warned by D.C. police that many in the crowds were secretly carrying weapons.

“They shot a girl!” someone yelled as a group of Trump supporters ran out of the southeast entrance.

A team of paramedics with a gurney soon arrived and a Capitol Police officer stepped aside to let them pass. “White female, shot in the shoulder,” the officer said as they hurried past. They emerged minutes later.

On the gurney was a woman later identified as Ashli Babbitt. Dressed in jeans, the 35-year-old gazed vacantly to one side, her torso and face covered in blood. Babbitt, a California native and an Air Force veteran, was a staunch supporter of the president.

As the gurney was loaded into the back of the ambulance, pro-Trump rioters swarmed around it, screaming, “Murderers!”

Capitol Police officers with long guns pushed them back, and the ambulance drove off.

Inside, where the lawmakers had donned gas masks kept under their chairs, Rep. Jamie B. Raskin (D-Md.) could only think of his family as he and other lawmakers hid from the mob. Reeling from the loss of his 25-year-old son last week, Raskin had taken one of his daughters and his son-in-law to the Capitol to watch the debates unfold over certification of Biden’s election, he said, “because we wanted to be together.” Raskin was helping lead Democrats’ arguments against Republican objectors.

“I thought I could show them the peaceful transfer of power in the United States of America,” Raskin told C-SPAN earlier. “What was really going through my mind was their safety because they were not with me in the chamber, and I just wanted us all to get back together.”

Rep. Abigail Spanberger (D-Va.) said members were told that chemical irritants had been released in Statuary Hall and, for a moment, braced for the possibility that they would be exposed to tear gas. Capitol Police barricaded the doors with tables and bookshelves.

Spanberger, a former CIA case officer, said that it was a crisis she would only expect to see unfold in fragile, faraway places.

“This is what we see in failing countries,” she said. “This is what leads to a death of democracy.”

The shooting and the breach triggered an instant call for help across Washington to other law enforcement agencies. At the U.S. Secret Service, headquarters sent out an emergency alert to all gun-carrying Secret Service personnel to report to headquarters in preparation to help secure the Capitol.

Meanwhile, dozens of other rioters streamed into the building, where they smashed windows and vandalized offices amid furious clashes with officers desperate to maintain control.

“MURDER THE MEDIA,” read a message written on one door.

“WE WILL NOT BACK DOWN,” read another left in the office of House Speaker Nancy Pelosi (D-Calif.), who also refused to back down, later directing her colleagues to return and finish validating Biden’s victory.

Rep. Karen Bass, a Democrat from California, shared a photo on Twitter of a long-haired man in a Trump hat carrying a rostrum adorned with the gold-colored seal of the speaker.

“Arrest this man,” she demanded.

At 3:30 p.m., more law enforcement in riot gear arrived at the Capitol.

“Traitors,” Trump supporters shouted. “What’s your oath?”

Biden condemned what he called an “unprecedented assault” on American democracy, “unlike anything we’ve seen in modern times.”

“This is not dissent. It’s disorder. It’s chaos,” he said. “It borders on sedition, and it must end now.”

For hours, Trump made little effort to quell the violence he had helped instigate, finally sharing a video at 4:17 p.m. in which he told people to “go home” — while continuing to promote the falsehood that he had won the election.

“We love you,” he told them. “You’re very special.”

The Capitol has been the target of violence before. In 1954, Puerto Rican nationalists opened fire from a House gallery, injuring five lawmakers on the floor below. In 1971, a bomb planted by a radical left-wing group exploded, though no one was harmed. In 1998, a gunman opened fire, killing two Capitol Police officers. But not since the British set fire to the Capitol in 1814 has a mob overrun the ultimate symbol of American freedom.

The fallout on Wednesday was immediate, stunning the world, the country and, perhaps most of all, political Washington. Former presidents Barack Obama and Bill Clinton joined Republican Sen. Mitt Romney (Utah) in denouncing Trump for provoking the mob, while Twitter, Facebook and Instagram all temporarily banned him from their platforms. Several conservative lawmakers who had planned to object to Biden’s certification announced that they had changed their minds.

Shortly after 8 p.m., just an hour or so after hundreds of law enforcement officers had at last finished clearing the mob and removing Trump flags left inside the building, heavily armed FBI agents and police officers in riot gear escorted lawmakers back to work.

As discussion inside the battered building resumed, the sense of fear that had gripped the nation’s capital for much of the day had yet to subside.

Federal agents were investigating a pickup truck found with weapons, ammunition and potential bombmaking material parked outside the Republican National Committee, according to two people familiar with the inquiry who spoke on the condition of anonymity because they were not authorized to discuss it. The truck, parked across the street from the party offices and near the entrance to a Metro station, contained rifles and shotguns and a mass of ammunition, these people said. Federal agents were still trying to determine whether that vehicle and its contents are connected to suspected pipe bombs found earlier in the day.

By late evening, D.C. Police Chief Robert J. Contee III said officers had arrested at least 52 people, including four for carrying pistols without a license, one for possession of a prohibited weapon and 47 for curfew violations and unlawful entry. Along with the pipe bombs, he said, police discovered a cooler packed with molotov cocktails on the Capitol grounds. In total, 14 D.C. officers were injured Wednesday. One was hospitalized after being pulled into a crowd and assaulted, and another received “significant facial injuries” after being hit with a projectile.

Just past sunset, a man was stabbed at 12th Street and Pennsylvania Avenue NW, near Freedom Plaza, but it was unclear whether the attack was related to the assault at the Capitol, a mile east.

Those who had made it inside the building took on a celebrity status when they came back out. A woman who said she had footage on her phone of Capitol Police pointing guns at rioters was circled by dozens who wanted to see it. People traded what information they had about the woman who was shot inside. Some called her a “martyr.”

After she was taken away, the mood soured, though many remained joyous. “We’re making history,” one woman said as she strolled down Independence Avenue with friends.

Beneath streaming flags, including some that read “F--- Biden” and that depicted Trump as the movie character Rambo, people loudly exhorted Jesus and chanted “USA!”

Many called friends and family and took videos.

“We weren’t violent before, but we are now,” a middle-aged White man said, talking into his cellphone. “There’s no going back.”

Peter Hermann, Rachel Chason, Marissa J. Lang, Carol D. Leonnig, Devlin Barrett, Perry Stein, Emily Davies, Jessica Contrera, Katie Mettler, Rachel Weiner, Michael E. Ruane, Michael Brice-Saddler, Harrison Smith, Clarence Williams, Antonio Olivo, Teo Armus, Justin Wm. Moyer and Fredrick Kunkle contributed to this report.