About 300 troops have been sent to the north-eastern Brazilian city of Fortaleza to tackle a surge in criminal violence, authorities said.
Soldiers will patrol there and across the state of Ceará in a bid to halt attacks on shops, banks and buses.
The justice ministry ordered the special deployment after dozens of attacks this week.
The attacks are a protest against new, tougher measures in local prisons, largely controlled by criminal gangs.
Prison authorities in the state have blocked mobile phone signals inside jails and ended a policy of separating inmates by gang affiliation.
The troop deployment comes just days after the inauguration of President Jair Bolsonaro, who was elected to office on the promise to fight rampant crime in the country.
Mr Bolsonaro reportedly praised Justice Minister Sergio Moro’s decision to send in troops as “apt, rapid and effective”.
Mr Moro previously led a vast investigation into Brazilian corruption known as Operation Car Wash.
Security videos aired on Brazilian television show the gangs setting fire to service stations.
About 50 suspects allegedly linked with the violence have now been arrested.
According to World Prison Brief, Brazil has more than 700,000 people behind bars – the third-highest prison population worldwide after the US and China.
Mr Bolsonaro, 63, won the presidential election by a wide margin against Fernando Haddad of the left-wing Workers’ Party on 28 October.
He is seen as a deeply divisive figure whose racist, homophobic and misogynistic remarks have angered many.
In his inauguration speech the president pledged support for the military and police, saying: “The national motto is order and progress. No society can develop without respecting these.”
In an apparent reference to gun control, he said: “Good citizens deserve the means to defend themselves.” He recently tweeted that he would issue a decree to allow citizens who did not have a criminal record to own guns.
Before becoming a politician, Mr Bolsonaro served in Brazil’s military, where he was a paratrooper and rose to the rank of captain.
He retains close links to the armed forces.