Lula, a leftist president, said the local militarized police force that reports to Brasilia governor Ibaneis Rocha, a former Bolsonaro ally, did nothing to stop the protesters advancing.

Lula decreed federal intervention of public security in the capital and promised exemplary punishment for the leaders of the "fascist" assault that was aimed at provoking a military coup that could restore Bolsonaro to power.

"All the people who did this will be found and punished," Lula told reporters from Sao Paulo State.

Lula blamed Bolsonaro for inflaming his supporters after a campaign of baseless allegations about election fraud after the end of his rule marked by divisive nationalist populism.

From Florida, where Bolsonaro flew 48 hours before his term ended, the former president rejected the accusation. He said on Twitter that peaceful demonstrations were democratic but the invasion of government buildings "crossed the line."

The assault raised questions among Lula's allies about how security forces in the capital were so unprepared and easily overwhelmed by rioters who had discussed plans on social media for days about gathering for weekend demonstrations.

The invasion, which recalled the assault on the US Capitol two years ago by backers of former president Donald Trump, was condemned by world leaders, from US president Joe Biden to European leaders and Latin American heads of state.

"The violent attacks on democratic institutions are an attack on democracy that cannot be tolerated,"German chancellor Olaf Scholz said on Monday. British prime minister Rishi Sunak condemned any bid to undermine the peaceful transfer of power.

Kremlin spokesman Dmitry Peskov said Russia condemned "in the strongest terms" the actions of those who instigated the disorder.

Brazilian markets are expected to take a knock when they open on Monday.

Hundreds arrested

Police retook the damaged public buildings in the futuristic capital after three hours and dispersed the crowd with tear gas.

Justice minister Flavio Dino said 200 demonstrators had been arrested. Governor Rocha, writing on Twitter before the court announced its move, put the number at 400.

Dino said investigations would aim to uncover who financed the several hundred buses that brought Bolsonaro's supporters to Brasilia and also probe Rocha for not preparing security.

The occupation of the government buildings had been planned for at least two weeks by Bolsonaro's supporters in groups on social media messaging platforms such as Telegram and Twitter, yet there was no move by security forces to prevent the attack, called by one group "the seizure of power by the people."

Messages seen by Reuters throughout the week showed members of such groups organizing meeting points in several cities around the country, from where chartered buses would leave for Brasilia, with the intention to occupy public buildings.

The plan included camping in front of the army command's headquarters, where demonstrators had camped out since Lula narrowly won the election in October.

In the early afternoon of Sunday, when the protesters began to arrive on Brasilia's esplanade, instead of being contained, they were escorted by Military Police cars with flashing lights.

Riot police only arrived on the scene two hours after the invasions began.

Bolsonaro faces legal risks from several investigations before the Supreme Court in Brazil and his future in the United States, where he traveled on a visa issued only to sitting presidents, is in question.

"Bolsonaro should not be in Florida," Democratic Congressman Joaquin Castro said on CNN. "The United States should not be a refuge for this authoritarian who has inspired domestic terrorism in Brazil. He should be sent back to Brazil."