RIO DE JANEIRO — Besieged by protests, Brazil’s president on Wednesday deployed federal troops to restore order in the capital, Brasília, after demonstrators calling for his ouster clashed with security forces.

Defense Minister Raul Jungmann went on national television on Wednesday afternoon to insist that President Michel Temer was only trying to restore calm in the capital by calling in the troops to patrol some areas. One of the city’s iconic modernist buildings, the Agriculture Ministry, was set on fire, and other government buildings were vandalized during the mayhem. Regional officials in Brasília put the number of protesters on Wednesday around 35,000.

“A protest that was supposed to be peaceful deteriorated into violence, vandalism and disrespect,” Mr. Jungmann said.

While supporters of the move say the capital must remain calm and functioning, the use of the armed forces in Brazil touches a nerve among critics of the military dictatorship that ruled the country from 1964 to 1985, a period known for human rights abuses and the restriction of civil liberties.