Five favelas were targeted by around 1,300 police and 3,600 troops to stop gang-related crimes.
Thousands of Brazilian army troops raided Rio de Janeiro slums in a pre-dawn crackdown on crime gangs on Saturday, leaving parts of the city looking like a war zone on the first anniversary of the opening of the Olympic Games.
Five favelas were targeted by around 1,300 police and 3,600 troops in a swoop starting at 4:00 am (0700 GMT), the Rio state security service said in a statement.
Their main goal was to stop gangs behind a surge in brazen robberies of commercial trucks, with arrest warrants issued for 40 people. Rio state authorities say there were 10,000 cases of cargo theft last year.
By mid-afternoon, "two criminals were killed in confrontations," Rio state security chief Robert Sa said.
But the decision to flood some of Rio's most dangerous streets with heavily armed soldiers also reflected fears that nearly bankrupt post-Olympic Rio is spinning out of control.
The troops were part of 8,500 deployed to the city last month in a tacit acknowledgement that cash-strapped police have lost the ability to cope.
Security check in favelas
In Lins favela -- one of the many little-regulated, and often gang-plagued communities of working class Brazilians that rise on the city's forest-clad hills -- soldiers took positions at every crossroads and outside many alleyways.
Troops, backed by camouflaged armored personnel carriers, stood guard with fingers on the triggers of assault rifles. Units of soldiers and SWAT police also roamed the streets in open Jeeps and SUVs, pointing their weapons out of car windows.
Everyone entering and leaving the favela, in northern Rio, was subjected to an identity check and search, with men required to lift their shirts. One man was questioned at length about a scar on his stomach and another man's bag was searched only to find he was carrying a large Bible.
The orderly deployment and impressive firepower reassured some. At a time of political and economic turmoil in Brazil, the military is regularly cited as Brazil's most trusted institution.
"They bring security to us all. There's so much robbery, so much shooting. With the soldiers, people here feel safer," said Luiza, a resident of Lins, who like most others was too afraid to be fully identified.
Others, however, were upset at suddenly having to live in the middle of what resembled military rule.
"There's an atmosphere of tension and fear," said Vanuza Barroso da Silva, 23, who was leaving Lins to go to her job at a supermarket.
"They treat us as if we're trash," her father Roberto, 46, said after going through the search.
Officials said the other favelas targeted were Camarista Meier, Morros de Sao Joao and Engenho Novo in the north and Covanca in the west.
The crackdown came a year to the day after President Michel Temer opened the Olympics in a lavish ceremony at the Maracana football stadium, which is close to Lins favela.
Rio was the first South American city to host the Games and although the event passed off smoothly, a mixture of corruption scandals, near collapse in the state budget and crime has combined into a serious hangover for what should be one of Brazil's richest regions.
In the first half of this year Rio tallied 3,457 homicides, the highest level of violence since 2009 and 15 percent more than during the same period in 2016.
People are killed daily in shootouts between rival gangs competing for control of the favelas or from police action. The shootings, often involving high-powered rifles, also lead to numerous deaths and injuries from stray bullets.
Since the beginning of the year 93 police officers have been killed in Rio state, while units complain of not having enough funds for fuel or even toilet paper.