RIO DE JANEIRO (AP) — Brazilian authorities were picking up pieces and investigating Monday after thousands of ex-President Jair Bolsonaro’s supporters stormed Congress, the Supreme Court and presidential palace then trashed the nation’s highest seats of power.

The protesters were seeking military intervention to either restore the far-right Bolsonaro to power or oust the newly inaugurated leftist Luiz Inácio Lula da Silva in scenes of chaos and destruction reminiscent of the Jan. 6, 2021, insurrection at the U.S. Capitol.

Rioters donning the green and yellow of the national flag on Sunday broke windows, toppled furniture, hurled computers and printers to the ground. They punctured a massive Emiliano Di Cavalcanti painting in five places, overturned the U-shaped table at which Supreme Court justices convene, ripped a door off one justice’s office and vandalized an iconic statue outside the court. The monumental buildings’ interiors were left in states of ruin.

In a news conference late Sunday, Brazil’s minister of institutional relations said the buildings would be inspected for evidence including fingerprints and images to hold people to account, and that the rioters apparently intended to spark similar such actions nationwide. Justice Minister Flávio Dino said the acts amounted to terrorism and coup-mongering and that authorities have begun tracking those who paid for the buses that transported protesters to the capital.

“They will not succeed in destroying Brazilian democracy. We need to say that fully, with all firmness and conviction,” Dino said. “We will not accept the path of criminality to carry out political fights in Brazil. A criminal is treated like a criminal.”

So far, 300 people have been arrested, the federal district’s civil police said on Twitter.

In the months that followed Bolsonaro’s Oct. 30 electoral defeat, Brazil was on edge – leery of any avenue he might pursue to cling to power. Bolsonaro had been stoking belief among his hardcore supporters that the electronic voting system was prone to fraud — though he never presented any evidence. And his lawmaker son Eduardo Bolsonaro held several meetings with Trump, Trump’s longtime ally Steve Bannon and his senior campaign adviser, Jason Miller.

Results from Brazil’s election — the closest in over three decades — were quickly recognized by politicians across the spectrum, including some Bolsonaro allies, as well as dozens of governments. And Bolsonaro surprised nearly everyone by promptly fading from view. He neither conceded defeat nor emphatically cried fraud, though he and his party submitted a request to nullify millions of votes that was swiftly dismissed.

Brazilians have used electronic voting since 1996. Election security experts consider such systems less secure than hand-marked paper ballots because they leave no auditable paper trail. Brazil’s system is, however, closely scrutinized and domestic authorities and international observers have never found evidence of it being exploited to commit fraud.

Still, Bolsonaro’s supporters refused to accept results. They blocked roads and camped outside military buildings, urging the armed forces to intervene. Protests were overwhelmingly peaceful, but isolated threats of terrorism — including a bomb found on a fuel truck headed to Brasilia’s airport — had prompted security concerns.

Two days before Lula’s Jan. 1 inauguration, Bolsonaro flew to the U.S. and took up temporary residence in Orlando. Many Brazilians expressed relief that, while he declined to participate in the transition of power, his absence allowed it to occur without incident.

Or so it had been, until Sunday’s havoc.

“Bolsonarism mimics the same strategies as Trumpism. Our Jan. 8 — an unprecedented manifestation in Brazilian politics — is clearly copied from Jan. 6 in the Capitol,” said Paulo Calmon, a political science professor at the University of Brasilia. “Today’s sad episodes represent yet another attempt to destabilize democracy and demonstrate that the authoritarian, populist radicalism of Brazil’s extreme right remains active under the command of former President Bolsonaro, the ‘Trump of Latin America.’”

U.S. President Joe Biden tweeted that the riots were an “assault on democracy and on the peaceful transfer of power in Brazil,” and that he looked forward to continue working with Lula.

In a news conference from Sao Paulo state, Lula read a freshly signed decree for the federal government to assume control of security in the federal district. He said that the so-called “fascist fanatics,” as well as those who financed their activities, must be punished, and also accused Bolsonaro of encouraging their uprising.

Bolsonaro repudiated the president’s accusation late Sunday. Writing on Twitter, he said peaceful protest is part of democracy, but vandalism and invasion of public buildings are “exceptions to the rule.” He made no specific mention of the protesters’ actions in Brasilia.

“He is evidently the intellectual mentor of what is happening, so he cannot dissociate from it,” said Mario Sérgio Lima, political analyst at Medley Advisors. “These groups were created by him, by the radicalism he imposed on politics. There is no way to undo that. … It seems his group has already crossed the Rubicon.”

Unlike the 2021 attack in the U.S., few officials would have been working in the top government buildings on a Sunday. And videos showed limited presence of the capital’s military police. That led many in Brazil to question whether the police had ignored abundant warnings, underestimated their abilities or had been somehow complicit.

One video showed a group of protesters pushing through a police barricade with limited struggle, and only a few officers deploying pepper spray. Another showed officers standing by as protestors stormed Congress, including one recording images on his phone.

“This was a gross error by the federal district’s government. It was a tragedy foretold,” said Thiago de Aragão, director of strategy at Brasilia-based politican consultancy Arko Advice. “Everyone knew they (the protesters) were coming to Brasilia. The expectation was that the federal district’s government was going to mount a response to protect the capital. They didn’t do any of that.”

Lula said at his news conference there was “incompetence or bad faith” on the part of police, and he promised some would be punished.

Federal District Gov. Ibaneis Rocha confirmed on Twitter he had fired the capital city’s head of public security, Anderson Torres. Local media reported that Torres is in Orlando for vacation, and that he denied having met with Bolsonaro there.

“Two years since Jan. 6, Trump’s legacy continues to poison our hemisphere,” U.S. Sen. Bob Menendez, who chairs the Senate’s foreign relations committee, tweeted, adding that he blamed Bolsonaro for inciting the acts. “Protecting democracy & holding malign actors to account is essential.”