Luiz Inacio Lula da Silva, the Brazilian president, has said rioters will be found and punished with the "full force of the law" after supporters of Jair Bolsonaro, the former leader, invaded the presidential palace, Congress, Supreme Court and ministries' building.
Footage and images on social media show what looked like thousands of people, many draped in the yellow and green of the Brazil flag, streaming up the steps of the National Congress building in the capital city.
It is understood the supporters broke through a blockade set up by security forces and invaded the ministries building and Congress.
There were no immediate reports of deaths or injuries from the riots, but the invaders left a trail of destruction,
throwing furniture through the smashed windows of the presidential palace, flooding parts of Congress with a sprinkler
system and ransacking ceremonial rooms in the Supreme Court.
The Congress, Supreme Court and the presidential palace have now all been retaken by security forces, according to Brazilian news channel GloboNews.
Local media estimated that about 3,000 people were involved.
At least 300 people were arrested, according to local police in Brasilia.
The president, who is known as Lula, was in Sao Paulo state on an official trip at the time of the protests but then travelled to Brasilia to tour the Supreme Court building to see the damage for himself.
Rioters are 'fascists, fanatics'
Lula declared a federal security intervention in Brasilia after the riots, branding the protesters "fascists, fanatics" and saying they would be punished "with the full force of law".
The federal intervention in the Brazilian capital will last until 31 January, he added.
He described the protests as "barbarism" and said everyone involved in the riots "will be found and punished".
Lula later accused Mr Bolsonaro of being a "genocidist" who "is encouraging this via social media from Miami".
"Everybody knows there are various speeches of the ex-president encouraging this."
Those who targeted Congress climbed the building's roof and broke the glass in its windows.
Protesters were seen on television smashing furniture inside the Supreme Court and Congress.
Bolsonaro rejects accusations
Mr Bolsonaro said he "repudiates" Lula's accusations as he reacted to the invasion of government buildings in Brasilia.
He tweeted that peaceful demonstrations were a part of democracy but that any invasion of public buildings "crosses the line".
Images on TV channel Globo News showed protesters roaming the presidential palace.
Some of those who protested have called for the military to get involved in restoring Mr Bolsonaro to power, carrying banners that proclaim "military intervention".
Some of the pictures that have emerged showed protesters clashing with security personnel, with tear gas being used.
Videos posted on Twitter also revealed the destruction protesters have caused inside the Supreme Court, including trashed-up furniture and smashed windows.
Criminal investigation requested
The Public Prosecutor's Office said that the attorney general requested the "immediate opening of criminal investigative proceedings aimed at the accountability of those involved".
The Solicitor General Office said it has requested the arrest of Anderson Torres, Brasilia's public security secretary, over the riots.
Alexandre de Moraes, a justice on the Supreme Court, announced late on Sunday that the court would remove Ibaneis Rocha, the city governor, for 90 days - alleging security flaws that allowed the invasion of the government buildings.
The incidents have echoes of the January 6 invasion of the US Capitol in 2021 and come after the left-wing Lula was sworn in on 1 January.
Supporters of Mr Bolsonaro have protested against Lula's election win since 30 October, blocking roads, setting fire to vehicles and gathering outside military buildings, asking the armed forces to intervene.
Lula beat Mr Bolsonaro in the vote but the former president repeatedly questioned, without evidence, the credibility of the country's electronic voting system. Many of his hardcore supporters have continued to believe him.
The invasion of Congress comes days after reports that the presidential palace was in a "deteriorated" condition after Mr Bolsonaro moved out, with several items allegedly missing.
According to Lula's wife, who showed Brazilian TV network TV Globo around after she moved in, rugs had been torn, floors damaged, a window broken, water leaks had stained a ceiling and a massive banquet hall left bare of furniture.
Mr Bolsonaro left Brazil for Florida 48 hours before his full term elapsed.
'Conservative coup attempt'
Many world leaders have come out to support the government, with Pedro Sanchez, the Spanish prime minister, tweeting: "All my support to President Lula and to the free and democratically elected institutions of the Brazilian people."
Antony Blinken, the US secretary of state, said the US condemned the attacks and called for the "immediate end" to the riots.
Joe Biden, the US president, called the situation in Brazil "outrageous" and condemned "the assault on democracy and on the peaceful transfer of power in Brazil".
James Cleverly, the UK's foreign secretary, tweeted: "The violent attempts to undermine democracy in Brazil are
unjustifiable. President Lula and the government of Brazil have the full support of the UK."
Emmanuel Macron, the French president, said the will of the Brazilian people and the democratic institutions "must be respected", before saying Lula can "count on France's unwavering support".
Lopez Obrador, the Mexican president, tweeted he condemned the "conservative coup attempt" in Brazil, adding that rioters were "encouraged by the oligarchic power leadership, their spokespersons and fanatics".
Gabriel Boric, the Chilean leader, said: "The Brazilian government has our full support in the face of this cowardly and vile attack on democracy."