Heavily armed police cracking down on gangs ahead of Rio's famed carnival celebrations killed at least seven alleged drug traffickers on Wednesday, sweeping through two slums with automatic weapons and armored vehicles.

Five suspects were killed in the Jacarezinho shantytown and two more were killed after fleeing to the neighboring Mangueira, police inspector Rodrigo Oliveira said. The operation was aimed at seizing drugs and stolen vehicles, he said.

Brazilian media reported that nine suspects were killed, but Oliveira said he could not confirm the higher figure.

• Click here to view photos.

Carnival celebrations get into high gear Friday night in Rio, one of the world's most crime-ridden cities. Violence often breaks out before carnival, but usually evaporates after festivities begin.

Residents stood by stony-eyed, sometimes quietly hostile as police armored cars rumbled down the shantytown's narrow streets past graffiti proclaiming the area under the control of the Commando Vermelho drug gang.

The victims in Wednesday's violence, said Oliveira, "were all bandits, all actively resisting" the raid on gangs that steal cars and motorcycles. Police seized 30 motorcycles, four cars and an undetermined quantity of drugs.

A record 1,260 civilians died in clashes with police in Rio de Janeiro state last year, according to the Rio de Janeiro State Institute of Public Safety.

The tally only includes figures reported by police stations that have computers — omitting about one-third of precincts from the total.

While officials have promised that increased security will keep carnival celebrations peaceful, the city's police chief and nine top commanders were fired on Tuesday by Rio de Janeiro state Gov. Sergio Cabral after officers mounted a protest on Ipanema beach to complain about low salaries.

Public security chief Jose Mariano Beltrame characterized the protest as insubordination.

O Globo reported that 40 high-ranking officers sent a letter to Cabral demanding the reinstatement of Police Chief Ubiritan Angelo, and that 30 threatened to quit the force.

Beltrame said any commanders who leave the force will simply be replaced, the Agencia Estado news service reported.