The Capitol was in the early stages of a siege by President Trump’s supporters Wednesday when D.C. acting police chief Robert J. Contee III arrived. His officers had been called in as backup, but the U.S. Capitol Police, the federal agency in charge, was losing control.

Contee, his voice choked by mists of pepper spray, called Mayor Muriel E. Bowser (D), and they agreed to enact a 6 p.m. city curfew. Then they met up at a command center and watched on video feeds as D.C. officers tried in vain to help their federal counterparts hold back the rioters engaged in acts of insurrection.

The cascading events led to a frantic behind-the-scenes scramble, with Contee joining Capitol Police Chief Steven A. Sund to plead with the Defense Department to send help.

With rioters inside the building and members of Congress evacuated, D.C. police took charge, working with Capitol Police to clear the building so lawmakers could return and certify the results of the presidential election.

“There was basically a sense that we can’t let this happen,” said one city official who spoke on the condition of anonymity to describe private deliberations. “While we were watching it, the [city] was trying to get more resources to them.”

The grim day marked a remarkable, if somber, coda for a municipal government that has spent two decades trying to transform itself from a symbol of political corruption and malfeasance into one of competence and reliability.

Twenty years after Congress dissolved a federal control board that had seized authority over the nearly bankrupt city’s affairs from a troubled mayor, it was D.C. leaders rushing to the aid of national lawmakers amid a threat posed by a failing president.

To local officials, the outcome provided a vivid illustration of the burdens imposed on the city by the lack of full home rule. The District has no voting rights in Congress, which still oversees its budget, and, unlike the nation’s governors, Bowser does not have authority over the local National Guard, which reports to the secretary of the Army.

“Anyone who has been around the D.C. government for a long time will tell you it’s a real slap in the face to have to wait on the federal government,” said Neil Albert, a former deputy mayor who serves as president and executive director of the DowntownDC Business Improvement District. “We’ve come a long way since the control board. We’ve had 20 years of balanced budgets, a $2.5 billion surplus — higher than most other states or jurisdictions. After demonstrating a history of really mature, sensible leadership, it’s time we have authority over our own affairs.”

The assault on the Capitol marked the second time in less than a year that Bowser and Trump have squared off over jurisdictional control of the city’s security. In the summer, amid mass social justice protests in Washington, Trump ordered in the National Guard, over Bowser’s objections.

In a dramatic confrontation on June 1, federal law enforcement officers forcefully cleared hundreds of mostly peaceful demonstrators from Lafayette Square, just beyond the White House gates, using chemical agents and projectiles.

Bowser responded with outrage, commissioning the painting of “Black Lives Matter” in huge block letters along 16th Street NW leading to the park and renaming those blocks Black Lives Matter Plaza.

City leaders have seized on the confrontations — as well as clashes with the Trump administration over coronavirus rules on masks and mass gatherings — to renew their push for D.C. statehood. The decades-long movement has been stymied by staunch Republican opposition to the prospects of granting an overwhelmingly liberal city two Senate seats.

With Democrats in narrow control of the Senate and President-elect Joe Biden set to be sworn in Jan. 20, “we must get D.C. statehood on the president’s desk within the first 100 days,” Bowser said at a news conference this past week. She also called on Congress to transfer command of the D.C. National Guard from the president to the mayor’s office.

“I’m upset that 706,000 residents of the District did not have a single vote in Congress yesterday, despite the fact that our people were putting their lives on the line to protect our democracy,” Bowser said. “We should all be upset.”

Biden and Vice President-elect Kamala D. Harris have voiced support for statehood. But the legislation approved in a historic vote in the House last year still faces opposition in the Senate.

And city leaders’ hopes have been dashed in the past, including under President Barack Obama, whose historic 2008 campaign won early support from then-D.C. Mayor Adrian M. Fenty (D). On accepting Fenty’s endorsement in Southwest Washington, Obama pledged solidarity with the city’s aspirations to become a state. His enthusiasm for speaking up on the matter waned, however, through his tenure.

“It’s literally taxation without representation. As unconstitutional as one could imagine,” Fenty, now working in venture capital, wrote on Twitter on Thursday about the city’s dilemma.

Republicans have called statehood unconstitutional and accused Democrats of seeking political gain. In the summer, Sen. Tom Cotton (R-Ark.) pointed to arson at the historic St. John’s Church, a block from the White House, to argue that federal intervention proved crucial during the mass protests.

“Those riots were contained thanks to an impressive show of force by federal law-enforcement officers under federal control,” Cotton said in a news release. “One can only imagine how much worse the destruction would’ve been . . . if most of Washington was under control not of the federal government, but of a left-wing politician like Muriel Bowser, who frequently takes the side of rioters against law enforcement.”

Cotton also cited the late Marion Barry, a four-term D.C. mayor who was videotaped in a police sting in January 1990 for possessing crack cocaine — an image that came to symbolize the nationwide drug epidemic ravaging urban centers. It was under Barry’s leadership that the city nearly went bankrupt and Congress installed the D.C. Financial Control Board, which managed the city’s affairs from 1995 to 2001.

“We were the murder capital of the country, the crack epidemic was in full force, we had the control board,” said Steven ­Schneebaum, a lawyer and city resident who has argued in favor of D.C. leaders wresting control from the White House in appointing judges to local courts. “People justifiably looked at the city as something of a basket case.”

But Schneebaum added that Republicans have used the city’s past problems as a fig leaf to mask their real reasons for opposing greater home rule. He recalled the late Sen. Edward M. Kennedy (D-Mass.), who once attributed opposition among his colleagues to D.C. representation to the “four too’s” — the city was too urban, too Black, too Democratic and too liberal.

Urban redevelopment and gentrification over the past two decades has dramatically changed the city’s racial makeup, with the percentage of D.C. residents who are Black dropping from about 60 percent to about 46 percent since 2000 and the White population climbing from about 30 percent to about 42 percent.

But the city has remained a liberal bastion: In the November election, 92 percent of District voters backed Biden, with just 5 percent supporting Trump.

Late Wednesday, after police had secured the Capitol, Bowser and Contee toured the city together. At a news conference the next day, the mayor called the breach of the federal complex an act of “domestic terrorism and sedition.”

It was “an affront not only to our democracy,” she said, “but also to our values — the values that make the District of Columbia a welcoming, diverse and inclusive city.”

Though Trump has less than two weeks left in his presidency, Bowser said in an interview that the chaos of his tenure has highlighted the ongoing challenge facing local leaders charged with managing a city at the center of the nation’s red-hot political discourse.

“Trumpism will not die on January 20th,” the mayor said. “We have to be prepared for this new type of civic debate.”