Dozens of protesters demanding a military coup have forced their way into Brazil’s lower chamber of Congress in the capital, Brasilia.
At least 40 demonstrators scuffled with guards and took over the podium as a session began on Wednesday.
Denouncing government corruption, they called for a return to military rule, which Brazil saw from 1964 to 1985.
In Rio de Janeiro, police fired tear gas at public sector workers protesting against cuts.
The protesters swept past security guards and smashed a glass door to get into the parliament chamber, where they shouted “general here, general here” and sang the national anthem.
It took police three hours to round up all the protesters. They were all detained.
Later in the day, President Michel Temer’s spokesman, Alexandre Parola, called the protest an “insult” and said it was a “violation of the norms of democratic co-existence.”
A congressional deputy, Betinho Gomes said, “It’s worrying and serves as a warning. We are returning to an era of extremes.”
Public confidence in Brazilian institutions has been eroded by a massive corruption scandal and the impeachment of President Dilma Rousseff.
Mr Temer was Ms Rousseff’s vice-president before being promoted after her dismissal.
Last week she filed court documents accusing him of accepting a large bribe. His party says the money was a legal campaign donation.
Brazil was one of several Latin American nations where the military overthrew democratic governments in the 1960s and 70s.
The generals said they were countering the very real threat of a communist insurgency and had support from a considerable part of Brazil’s elite.
The regime detained, tortured and in some cases killed its opponents, while overseeing rapid economic growth.
Also on Wednesday, protesters gathered outside the state legislature where austerity plans to tackle financial crisis were being debated.
Police fired tear gas, rubber bullets and stun grenades into a crowd of about 2,000 protesters, ranging from teachers to off-duty police officers.
The State has been hit by a drop in global oil and commodity prices and declared a financial emergency ahead of the Rio Olympics earlier this year.
Many public workers have not been paid in months.