Brazil's president ordered federal troops to restore order in the country's capital, Brasilia, after some ministries were evacuated during clashes between police and protesters seeking Michel Temer's ouster.

Temer is struggling to retain power after the release of a recording that appears to capture him approving hush money for a convicted former politician. Brazil's top court is investigating him for alleged obstruction of justice and involvement in passive corruption. The president is resisting calls to resign and has said he will fight the accusations.

Tens of thousands of demonstrators marched to Congress on Wednesday to demand Temer step down and to protest against economic reforms that he is pushing through.

It was the most violent protest in Brasilia since anti-government demonstrations in 2013.

One protester was shot and wounded, police said. Local media reported at least one other demonstrator was seriously wounded by a rubber bullet to the face, while another lost part of his hand while trying to throw an explosive device at officers. The city government said 49 people were hurt.

What began as small scuffles between police and protesters who tried to jump a cordon mushroomed into a series of clashes, in which officers fired tear gas and pepper spray to contain the crowd. Protesters set fires and used portable toilets to create barricades.

As the fighting escalated, some government agencies were evacuated, the president's office said. The G1 news portal reported that protesters set a fire in the agriculture ministry.

READ MORE: Michel Temer accused of obstruction of justice

In a brief national address during the unrest, Defence Minister Raul Jungmann said troops were being sent to guard federal buildings, including the presidential palace. The deployment was authorised by a presidential decree that left open the possibility that soldiers could be used more widely in Brasilia. The decree said Jungmann would decide the scope.

Brazil: Protesters call for Temer to resign

"This mess, this mayhem is unacceptable," Jungmann said. "President Temer will not allow that."

Jungmann added that troops had already entered the foreign ministry. Images on television showed soldiers outside the presidential palace.

The move to use the military in the face of protests could heighten anger at the government and senior officials were already distancing themselves from the decision.

Rodrigo Maia, the speaker of the lower house of Congress, said he had asked Temer to instead use the National Force, an elite police entity. Justice Marco Aurelio Mello, of Brazil's highest court, said he was "a little concerned about the context" of Temer's decision.

A riot police officer lies on the ground after getting hit with a brick thrown by protesters on Wednesday [Adriano Machado/Reuters]

Al Jazeera's Lucia Newman, reporting from Brasilia, said the troop deployment was highly unusual.

"It is the first time since 1980 when Brazil was under a military dictatorship that something like this has happened and it is causing quite a controversy," Newman said.

"The fact of the matter is President Michel Temer signed the order to bring out the soldiers. The fact that he did this is seen by many as an act of desperation - a smokescreen at a time when he is under increasing pressure to resign."

READ MORE: Brazil's beleaguered President Temer refuses to resign

Temer's popularity was low even before the latest scandal broke, in part because of opposition to an economic overhaul that he wants to push through Congress, including loosening work rules and changing the pension system. Several of his allies and aides have also been caught up in a wide-ranging corruption investigation that has jailed business leaders and senior politicians.

While Congress debated a move to impeach the president, 35,000 people were marching towards the chamber down a long avenue lined with the main government buildings, including the Supreme Court, the presidential palace and the ministries.

Protesters shouted "Out with Temer!" and carried signs calling for immediate direct presidential elections.

James Green, director of the Brazil Initiative at Brown University, said that Temer's position was very weak as he appeared to have lost the support of large sectors of his base, as well as powerful sectors of the country's economic elites.

"The reason he hasn't resigned yet is because he is still in the process of negotiating with the two main coalition party members to figure out who the Congress will actually choose as the president once he resigns," he told Al Jazeera from Sao Paulo.

If Temer resigned, the Constitution says Congress would elect the next president, who would hold power for the rest of his term, which runs to the end of 2018. But many Brazilians, disgusted with the political class, want to vote themselves.

"The country is entirely polarised," Green said. "Although this is not Brazil's worst economic crisis, the unemployment and the slow growth of the economy are all exacerbating the tensions and there is tremendous disappointment and displeasure with his rule."

Source: Al Jazeera and news agencies