Nearly 5,000 troops and police were sent into favelas around Rio de Janeiro during the first weekend of August, deployed in an operation responding to a wave of commercial-truck robberies around the city.

The 3,600 soldiers and 1,300 police were dispatched to five of the city’s favelas – economically mixed but underdeveloped communities – exactly one year after Brazilian President Michel Temer opened the 2016 Olympic Games in Rio.

The Olympics, along with the 2014 World Cup, were the high point of a decade of expansion and optimism for many in Brazil, a sentiment buoyed by high commodity prices that boosted the economy.

But that economic boost has faded, and in the year since the the Olympics – which left an increasingly ugly legacy – violence has returned in full force to Brazil’s second-biggest city.

Though the city is still below violence levels of the 1990s, official data shows homicides in Rio de Janeiro state rose to 3,755 in the first half of 2017 compared to the same period a year earlier - a 14% increase.

One Rio de Janeiro newspaper, Extra, has begun covering crime and violence in a section titled "Rio War," an expression it said it had long avoided. The paper said it would continue to cover crime common in large cities but document more serious cases under its new section.

"A fetus shot in the mother's belly is not just a police case," the paper said, referring to a recent case in which a pregnant woman was hit by a stray bullet and lost her child. "It is a symptom that something very serious occurs in society."

Brazil Rio de Janeiro soldiers beach sunbather troops

Foto: Brazilian navy soldiers patrol the Copacabana beach as part of a plan to combat organized crime in Rio de Janeiro, Brazil, July 30, 2017. source REUTERS/Sergio Moraes

Drug-trafficking groups and other gangs now control large swaths of the city, as they have in the past, and confrontations between rival gangs and police leave people dead every day.

"We've counted 197 days of shootouts through July," Thainã de Medeiros, a resident of Alemão favelas, told PRI. "So many lives lost, including both residents and police."

Bystanders are often struck by stray bullets - 632 of them between January 1 and July 2. Recently, a doorman was killed by a grenade near Copacabana beach.

One-third of the city's 1,500 public schools are in areas considered to be at risk of violence; just seven of the first 120 days of the academic year went by without at least one school closing because of violence.

During the last half of 2016, there were 68,000 armed robberies in the city - about 340 a day.

Brazil Rio de Janeiro police soldiers arrest

Foto: Security forces search residents during an operation against organized crime in the Manguinhos slum complex in Rio de Janeiro, August 21, 2017. source REUTERS/Ricardo Moraes

A federal legislator from the right-wing DEM party said Rio's struggling economy was driving insecurity, but he also pointed to issues farther afield, at the country's borders and failures to stop arms flowing across them.

"We got to today's situation because of unguarded borders," he said.

Arms imports have been intercepted at Brazil's borders and on roads leading into Rio. A shipment of assault rifles from Miami was recently stopped at Rio's international airport. Heavier weapons make criminals more ambitious; robberies of targets like trains, trucks, and boats have jumped 150% over the past three years.

Drugs have also long powered gangs, providing them with resources as police face a lack of funding, training, and weapons, according to a former captain in Brazil's elite military police, the BOPE. In 2015, Rio police made three times as many drug arrests as they did in 2008 and seized 22 tons of marijuana, four times what they seized in 2010.

Police in Rio de Janeiro are effectively in an undeclared, low-level war with powerful and well armed drug trafficking gangs

Foto: Mourners at the funeral of the 100th police officer killed in Rio this year, August 27, 2017. source © AFP Apu Gomes

This year is on pace to be the deadliest for the military police - street cops charged with patrolling and arresting suspects and who are formally part of the military - since 153 were killed in 2006.

A police officer slain in a suburb of Rio on August 26 was the 100th officer killed in the state so far this year.

A growing number are being killed while off-duty, either because they get involved in altercations without backup or because they're targeted.

Rio's 99th slain officer, killed on August 24, was gunned down after pulling into his garage; the 100th officer killed was shot multiple times while visiting his father.

A study by the state military police reported that a police officer in Rio was more likely to be killed on duty that a US soldier during World War II or Vietnam.

"The criminals know where the police live ... and if they kill one it raises their standing in the favela," retired officer Sergio Luiz da Silva, a friend of the officer killed on August 26, told AFP.

Police operations in Rio have also been hindered by corruption. Arrest warrants were issued in June for 185 officers who were accused of working with drug gangs - even renting automatic weapons to gunmen. A 19-year-old soldier was arrested in August on suspicion of tipping off gangs just hours before an operation against them started.

Rio police, shown here carrying out a pre-dawn crackdown on drug gangs in a favela, are demoralized and struggling to contain violence

Foto: Rio police, shown here carrying out a pre-dawn crackdown on drug gangs in a favela, are demoralized and struggling to contain violence. source © AFP/File Apu Gomes

Rio's police have a history of abuses; about 8,000 people have been killed during police actions over the past decade. The use of excessive force has reportedly grown considerably, and many victims are young, black men from marginalized areas, according to rights groups.

In 2015, 920 people were killed in confrontations with police, more than twice the 416 killed in 2013. Over the first half of the year, the number of people killed by Rio's police increased more than 45% to 581.

A doctor and a nurse assist a patient who was stabbed twice in the back at the emergency room of the Cidade de Deus shantytown Emergency Care Facility (UPA) in Rio de Janeiro, Brazil

Foto: A doctor and a nurse assist a patient who was stabbed twice in the back at the emergency room of the Cidade de Deus shantytown Emergency Care Facility (UPA) in Rio de Janeiro, Brazil. source © AFP Mauro PIMENTEL

The spike in violence comes alongside increasing unemployment in the wake of a recession and amid a deepening corruption scandal ensnaring the government and industry leaders.

The state has struggled to pay workers, powerhouse oil company Petrobras has laid off thousands, and Rio's tourism sector has shed more jobs than it added for the Olympics.

At the end of 2016, there were 14,279 homeless people, triple the number in 2013.

"Unemployment has consequences and one consequence is violence," Metalworkers' Union policy director Manoel Sales said after a tourist family was attacked in a Rio favela. "It is the reflection of all this."

While Rio state is not the worst in the country in terms of violence - in 2015 it was 16th of Brazil's 27 states in homicide rate and none of its municipalities were among the 30 most violent - the federal government has stepped in to shore up security as its financial distress (it faces a $6.73 billion deficit this year) prevented it from putting more police on the streets.

The deteriorating security situation in Rio comes less than a decade after the state embarked on an ambitious campaign against criminality. In 2008, after close to 30 years of heavy criminal influence there, the state government was convinced to try Pacification Police Units, or UPP.

The plan sent elite police units into communities were gangs and violence were problems. They were to be followed by social programs meant to reincorporate the community into the city and establish a bulwark against criminal influence.

Brazil Rio de Janeiro police troops soldiers

Foto: Brazilian Navy personnel during an operation against drug dealers in Mangueira slum in Rio de Janeiro, June 19, 2011. Rio's security forces started an operation in the slum to base a peacekeeping unit near Maracana Stadium ahead of the World Cup. source REUTERS/Ricardo Moraes

Initially it was effective and greeted with praise. But the program faltered as Rio's economic stability deteriorated, budget cuts hamstrung programs, and criminal groups resisted.

Police were also criticized for failing to adapt, as was the state for failing to fully implement social programs. As the state's credibility and commitment were called into question, public trust eroded. High-profile cases of police violence helped break the relationship.

Between July 2016 and July 2017, eight of the 10 favelas with the most shootouts had UPP units.

Brazil flooded Rio with 85,000 soldiers and police officers for security during the 2016 Olympics. In their absence, the security situation has worsened, and security forces have been repeatedly dispatched to quell violence.

Brazil Rio Olympics security preparations violence crime

Foto: Brazilian Public-Safety National Force, left, and military-police soldiers guard an entrance at the security fence outside the 2016 Rio Olympics Park in Rio de Janeiro, Brazil, July 21, 2016. source REUTERS/Fabrizio Bensch

The troops who raided five favelas during the first weekend of August - one of several such operations this month - were part of a 10,000-man force in the city, including 8,500 troops deployed at the end of July and several hundred members of various police forces. They are slated to remain there until the end of 2018.

The force in the city now will differ from previous deployments - rather than occupying problem areas, the operation "aims to use intelligence to reach organized crime ... to reduce its operational capacity and to strike at it," Defense Minister Raul Jungmann said in July, adding that the current operation would look to avoid mistakes of previous ones.

Extra's coverage of the conditions in Rio as a kind of "war" have earned it criticism for echoing and legitimizing the aggressive rhetoric used by the state in response to violence in the state and elsewhere in the country - a charge leveled at other outlets.

Brazil Rio de Janeiro

Foto: Brazilian security forces during an operation against organized crime in the Manguinhos slum complex in Rio de Janeiro, August 21, 2017. source REUTERS/Ricardo Moraes

The federal government's latest move to militarize of law-enforcement and crime-prevention efforts in Rio have been criticized, as such a strategy has become common in Latin America and is generally regarded as ineffective and counterproductive.

For some, the deployments stir memories of the country's military dictatorship and anti-democratic acts that occurred during it.

That Brazilian authorities are again relying on such an approach "clearly signifies" there is "no strategic plan" to address crime and violence in Rio, Brazil-based journalist Cecilia Olliveira told Insight Crime.

Military personnel were "being used to contain the immediate circumstances, but not resolve them," she added. "If this were an effective strategy, we would not need the army on the streets again."