By Gary Duffy
BBC News, Rio de Janeiro
The police force in Rio de Janeiro is facing a crisis after dozens of senior officers offered their resignations just days before the carnival.
The carnival will be in full swing this weekend
Forty-three officials signed a letter of resignation after their commander was sacked by the state governor.
The head of the military police was dismissed after he allowed a mass protest by officers over their pay to go ahead last weekend.
Security chiefs say they are confident the carnival will go ahead peacefully.
Carnival is the highest profile event of the year for the city of Rio de Janeiro and there could hardly be a more difficult moment for the city's police force to be confronted with such a crisis.
Governor Cabral dismissed the military police chief
The problems began last weekend when the commander of Rio's military police, Ubiratan Angelo, allowed officers to stage a mass protest to complain about low pay.
He also voiced his support for their demands, and was then dismissed by Rio's governor Sergio Cabral who said permitting the demonstration to go ahead had been an act of insubordination.
That decision caused widespread anger among senior police officers.
At least 43 officials have now offered to resign, 17 of them battalion commanders, Brazil's TV Globo reported.
Security chiefs say they are confident that carnival, which is expected to attract more than 700,000 Brazilian and overseas visitors will go ahead peacefully this weekend.
A new police commander has already been appointed, and the governor has accused the rebels of trying to stir up trouble.
In a separate development several alleged drug traffickers were killed when police backed by helicopters and armoured cars raided the favela or shanty town of Jacarezinho.
The operation was meant to seize drugs and stolen vehicles.
Police say all those who died were involved in drug gangs in the area, but human rights organisations have frequently complained that large-scale operations such as this often result in indiscriminate killings.
More than 1,200 people died in clashes with the police in the state of Rio de Janeiro last year.