RIO DE JANEIRO — Shootouts erupted in several areas of Rio de Janeiro on Friday, prompting Brazilian authorities to shut roads, close schools and ask for the Army to intervene.

Defense Minister Raul Jungmann said as many as 950 troops would be deployed around the perimeter of Rocinha, Rio’s largest favela, or slum, where some of the most intense battles were taking place.

Images on Globo News showed firefights between drug traffickers and military police moving into the area.

Jungmann said the troops would provide backup so that military police, including elite squads of commandos, could go after traffickers in the hills that make up the sprawling community in the city’s south.

The operation comes just as the city is hosting the Rock in Rio festival, featuring concerts by groups such as Bon Jovi, Guns N’ Roses and the Red Hot Chili Peppers. In a statement, Rock in Rio said Friday’s concert would go on as scheduled.

Military police, tasked with patrolling and going after suspects, had been doing operations in Rocinha since Monday. The intensity of the firefights — gunshots are often heard in Rio — increased Friday and erupted in other neighborhoods, including Alemao, Dona Marta, Vila Kennedy and Chapeu Mangueira.

Several roads were closed in the morning, though most had opened by the afternoon. Several schools closed or announced they were keeping students inside until the situation calms down.

Several gangs are fighting for predominance in Rocinha and violence also is fed by armed militias of former police and military personnel that sometimes take security into their own hands.

About 8,500 troops were deployed in August to try to curb rising violence a year after Rio hosted the Summer Olympics. However, the troops have mostly been patrolling, not engaging with traffickers.