Brazil's president canceled an order that sent 1,500 soldiers onto the streets of the capital following criticism the move was excessive and merely an effort to maintain power amid increasing calls for his resignation.
The troops were deployed late Wednesday following a day of bloody clashes between police and protesters demanding President Michel Temer's ouster amid allegations against him of corruption.
Fires broke out in two ministries and several were evacuated. Protesters also set barricades ablaze and vandalised government buildings.
The issue of troops on the streets is sensitive in a country that lived under military rule from 1964-1985.
In a decree, Temer revoked the order on Thursday to deploy the soldiers "considering the halt to acts of destruction and violence and the subsequent re-establishment of law and order".
On Thursday afternoon, soldiers began to leave their posts in Brasilia.
Defense Minister Raul Jungmann insisted the deployment was necessary "to stop the barbarity" of the riots.
"We had no choice in order to prevent casualties among public servants and the destruction of public heritage," Jungmann said.
Images in national media, meanwhile, appeared to show police officers firing weapons, and the Secretariat of Public Security said it was investigating. In all, 49 people were wounded, including one by a live round. The person was shot in the jaw and was sedated and in serious condition Thursday evening, the Secretariat of Health said.
Temer's popularity has been in freefall since he took office a little more than a year ago after his predecessor was impeached and removed. Some Brazilians consider his presidency illegitimate because of the way he came to power, and his efforts to pass a series of economic reforms to cap the budget, loosen labour laws and reduce pension benefits have made him even more unpopular.
In addition, several of his advisers have been linked to Brazil's big corruption investigation, known as Operation Car Wash.
As part of the Car Wash probe, Temer now faces allegations that he endorsed the paying of hush money to a former lawmaker who has been jailed for corruption. Brazil's highest court is investigating him for alleged obstruction of justice and involvement in passive corruption after a recording seemed to capture his approval of the bribe. Temer denies wrongdoing.
Many Brazilians want him out one way or another and are calling for him to resign or be impeached. The demands for his resignation have heated up since the release of the recording and came to a head in Wednesday's protest, when 45,000 demonstrators took to the streets.
Opposition lawmakers have submitted several requests in Congress for Temer's impeachment.
The use of troops in the nation's capital is particularly fraught in Brazil, where many still remember the repression of the country's 1964-1985 military dictatorship. Images of soldiers patrolling Brasilia increased the impression that Temer is struggling to maintain control and further ratcheted up pressure on him.
Source: News agencies