The “American carnage” that Donald Trump vowed to end at the dawn of his presidency was revived in terrifying, treacherous form at its sunset Wednesday, as Trump made a fiery last stand and incited his supporters to storm and sack the U.S. Capitol as part of an attempted coup.

The extraordinary anarchy that interrupted the tallying of electoral college votes in a joint session of Congress brought America’s democracy to the brink.

After Trump rallied thousands of people outside the White House by demanding the results be overturned and declaring his duly elected successor “an illegitimate president,” pro-Trump rioters breached police barricades, scaled walls and smashed windows to enter the Capitol.

The marauders freely roamed the building’s stately halls, some carrying Confederate flags. They occupied the Senate and House chambers and rummaged through desks. They vandalized the offices of congressional leaders. They assaulted police and other public servants. They trampled on the gleaming white platform constructed for President-elect Joe Biden’s inauguration. One tried to replace the U.S. flag flying above the balcony with a Trump campaign flag.

Lawmakers and staffers hid in locked bunkers. Vice President Pence and House Speaker Nancy Pelosi (D-Calif.) were spirited away by security to undisclosed locations. For hours through the afternoon, police struggled — and failed — to contain and disperse the mob. One rioter was shot under unclear circumstances during the melee and later died.

The pandemonium would seem to be a natural culmination of what Trump and compliant Republicans have wrought on the nation they swore an oath to protect.

Since his first presidential campaign, Trump has instigated his supporters to express their political views through physical demonstration and violence, and he has declined time and again to repudiate the actions of white supremacists, neo-Nazis and other extremists.

Prompted in a presidential debate last fall to condemn white supremacists and right-wing militia-style groups, Trump instead gave extremists an open invitation to act. “Proud Boys, stand back and stand by,” Trump said Oct. 2.

During his four years in office, Trump has been enabled and abetted by his Cabinet and staff, his family members and a battery of Republican elected officials — including the scores of House and Senate members who had indulged the president by vowing to object to Wednesday’s scheduled certification of Biden’s victory.

With Wednesday’s occupation underway, Trump’s eldest daughter, Ivanka, tweeted that the rioters were “American Patriots” and urged them to be “peaceful.”

Trump’s personal attorney Rudolph W. Giuliani — who hours earlier had suggested onstage at the rally outside the White House that the election be decided by a “trial by combat” — tweeted to the occupiers, “you are on the right side of the law and history.”

And the president himself fomented the uprising by encouraging attendees of his morning rally to march to the Capitol “to try and give [lawmakers] the kind of pride and boldness that they need to take back our country.” Trump told his crowd that he planned to walk with them, though he headed straight to the White House after his speech and did not leave the secure compound for the remainder of the day.

Trump, fuming about Pence’s decision to perform his constitutional duty to certify the election result rather than go rogue at the president’s demand, then ignored the urgent pleas of advisers and allies to forcefully call an end to the violence and chaos.

Only as darkness began to fall in Washington, more than three hours after rioters stormed the Capitol, did Trump release a video instructing his supporters to “go home.”

“We have to have peace. We have to have law and order,” he said.

But a few beats later, the president praised the lawbreakers. “We love you,” he said. “You’re very special.”

Biden characterized the day’s events unsparingly, calling them “insurrection” and “an assault on the most sacred of American undertakings: The doing of the people’s business.”

“This is not dissent,” Biden said. “It is disorder. It is chaos. It borders on sedition. And it must end. Now.”

Former president Barack Obama said Wednesday’s insurrection was to be expected, considering how Trump and his allies have responded to the president’s election loss.

“For two months now, a political party and its accompanying media ecosystem has too often been unwilling to tell their followers the truth — that this was not a particularly close election and that President-Elect Biden will be inaugurated on January 20,” Obama said in a statement. “Their fantasy narrative has spiraled further and further from reality, and it builds upon years of sown resentments. Now we’re seeing the consequences, whipped up into a violent crescendo.”

The National Association of Manufacturers, one of the nation’s premier business groups, which has long been friendly to Republicans, called on Pence and the Cabinet to consider invoking the 25th Amendment to force Trump from office.

The only other living Republican past president, George W. Bush, issued a statement that was stunning in the sharpness of its language, considering how long he had resisted criticizing Trump for his transgressions.

“Laura and I are watching the scenes of mayhem unfolding at the seat of our Nation’s government in disbelief and dismay,” Bush wrote. “It is a sickening and heartbreaking sight. This is how election results are disputed in a banana republic — not our democratic republic. I am appalled by the reckless behavior of some political leaders since the election and by the lack of respect shown today for our institutions, our traditions, and our law enforcement.”

History will remember Jan. 6, 2021, as a day without precedent in America’s 243-year experiment with democracy. Some past presidential election outcomes have been contested; in 1860, the dispute led to the Civil War. And the Capitol has been occupied before; it was attacked and set ablaze by British forces in 1814.

But never before has American democracy been so strained, the seat of representative government so imperiled and a president so at fault — so much so that Twitter, adhering to its rules for civic integrity and threats of violence, removed three of Trump’s messages and locked his account for 12 hours.

“It’s terrifying,” said historian Doris Kearns Goodwin, who has studied and written about Abraham Lincoln and other presidents. “There’s been nothing like this. . . . Democracy is absolutely at stake right now, and it’s up to the people.”

She added: “Lincoln said, ‘Public sentiment is everything. With it, nothing can fail. Against it, nothing can succeed.’ What he meant was that when there’s a settled feeling that something goes against the ideals of the country or something is wrong, and sometimes it can be an event, it’s up to the leaders to help shape that sentiment. And this is one of the biggest events that all of us have ever experienced in our lives.”

David Blight, a Civil War historian at Yale University, said the only possible parallel to the insurrection that unfolded in Washington on Wednesday is secession.

“That’s a radical act that ended up in civil war and an attempt to destroy the American republic,” Blight said. “There have been zillions of protests in Washington, D.C., some of them turned violent — about war, about civil rights, about all kinds of things — but no one’s ever breached the Capitol and taken it over. This was mobs of people acting against the state trying to disrupt the functioning of the state and being prompted by the sitting executive.”

Leaders around the globe watched, aghast, not knowing who was in charge of the world’s greatest democracy or whether order would be restored. Presidents and ministers in Ukraine, Estonia, Denmark and a host of other countries weighed in with alarmed concern about the fragility of government in the United States.

“Disgraceful scenes in U.S. Congress,” British Prime Minister Boris Johnson, who has been Trump’s closest friend among Western allies, wrote on Twitter. “The United States stands for democracy around the world and it is now vital that there should be a peaceful and orderly transfer of power.”

In the aftermath of World War II, the United States helped build an alliance of Western democracies. On Wednesday, the leader of that alliance, NATO Secretary General Jens Stoltenberg, felt compelled to guide the United States on how to repair its own democracy.

“Shocking scenes in Washington, D.C.,” Stoltenberg wrote on Twitter. “The outcome of this democratic election must be respected.”

Barry McCaffrey, a retired four-star Army general, said, “This is an overt coup attempt against the Constitution and to take over the government of the United States. This wasn’t a momentary, impulsive crowd. This was deliberately structured by Trump, almost all out in the open.”

Mabel Wilson, an architecture professor at Columbia University who has studied the history of the Capitol and other civic buildings, said the images she saw Wednesday not only represented a subversion of democracy, but also were a painful reminder of the racial injustice that had so animated Americans last year.

“How do they storm the Capitol and they’re not stopped and Black people can’t sleep in their beds like Breonna Taylor and not be murdered?” Wilson said. “White people could freely waltz in with arms onto federal property. And I watched them file out as if they’re just tourists wandering out.”

The day began with tensions running high and Republicans deeply divided. Protesters surrounded Sen. Todd C. Young (R-Ind.) outside the Russell Senate Office Building just after 11 a.m. Young said that though he had hoped Trump would win a second term as president, he would not be joining the 14 of his Republican colleagues, led by Sens. Ted Cruz of Texas and Josh Hawley of Missouri, who planned to object to certifying Biden’s victory.

“I think it’s a hijack effort,” Young said. Objecting, he explained, would violate the Constitution. “I took an oath under God,” he said.

As Young walked away, protesters shook their heads and spat at the ground. “Coward!” one shouted at the senator. “We’ll remember this,” another said. “You’re going to be primaried out.”

At the other end of Pennsylvania Avenue, meanwhile, Trump addressed his rally crowd at the Ellipse, with the White House as his grand backdrop. He began with a lie, declaring that there were hundreds of thousands of people there; attendance was far smaller.

Then another: “They rigged an election, they rigged it like they’ve never rigged an election before. … We won it by a landslide. This was not a close election.”

In fact, Biden won with 306 electoral college votes to Trump’s 232. Biden also won the popular vote by 7 million votes, or a 4.5 percentage point margin.

As he concocted his fantasy about the election, ticking through one baseless or debunked claim of fraud after another, Trump vowed, “We will never concede.”

Inside the Capitol, lawmakers began the ceremonial process of certifying the electoral college results. Senate Majority Leader Mitch McConnell (R-Ky.) delivered an impassioned plea to the rebels in his GOP conference who were determined to stay in Trump’s good graces by objecting. McConnell called this certification vote the most important he would take in his 36 years as a senator.

“If this election were overturned by mere allegations from the losing side, our democracy would enter a death spiral,” McConnell warned. “We’d never see a whole nation accept an election again. Every four years would be a scramble for power at any cost.”

Minutes later, however, the rioters breached the barricade. Soon, Pence, who had been presiding as president of the Senate, was whisked away. Doors to the chamber were locked. Senators went into hiding. Seven hours passed before the rioters were cleared, the chamber was secured and senators returned to the floor.

With Pence presiding at the dais, one senator after another, both Republicans and Democrats, condemned the violence that had occurred.

Sen. Mitt Romney of Utah, the lone Republican who voted to convict Trump in his impeachment trial last year, drew sustained applause in the chamber as he delivered an impassioned affirmation of democracy and truth.

“We gather today due to a selfish man’s injured pride and the outrage of his supporters who he has deliberately misinformed for the past two months and stirred to action this very morning,” Romney said. “What happened here today was an insurrection, incited by the president of the United States.”

And Sen. Lindsey O. Graham (R-S.C.), Trump’s frequent golfing partner and arguably one of his closest confidants in Congress, said he was effectively giving up on this presidency, 14 days before its expiration.

“Trump and I, we’ve had a hell of a journey,” Graham said. But, referring to contesting the election, he added: “Count me out. Enough is enough.”

Rachel Chason and Rebecca Tan contributed to this report.