Security authorities finally regained control of two Brazilian prisons almost 24 hours after rioting inmates killed at least 30 people, including some by beheading.
It is the latest in a string of prison disturbances across the country in which more than 100 people have died within two weeks.
Prison officials in the northern state of Rio Grande do Norte said the rioting broke out Saturday at the adjacent Alcacuz and Rogerio Coutinho lock-ups near the city of Natal.
Officials said the death toll was likely to rise as police assess the damage caused by the disturbance, apparently a clash between rival gangs who have been fighting for control of the prisons and of drug networks outside across northern Brazil.
The number of injured was not yet clear and officials did not identify the gangs involved.
State security chief Caio Cesar Bezerra said police decided to wait until dawn yesterday before entering the prisons to prevent the situation from worsening.
"This way we guaranteed a calm intervention, a pacific intervention without resistance from the inmates," Mr Bezerra said.
President Michel Temer expressed concern over the rebellion, saying he had been following the situation closely.
Like many prisons across the country, Alcacuz is overcrowded, with more than 1,000 inmates crammed into a facility meant for 620.
The recent outbreak of prison violence began on New Year's Day, when 56 inmates were killed in the northern state of Amazonas. Authorities said the Family of the North gang targeted members of Brazil's most powerful criminal gang, First Command, in a clash over control of drug-trafficking routes in northern states. Many of the dead were beheaded and dismembered. Four others died at a smaller prison.
Then on January 6, in the neighbouring state of Roraima, 33 prisoners were killed, many with their hearts and intestines ripped out.
Experts say First Command is exploiting overcrowding and squalid conditions to expand its reach across the national prison system.
Meanwhile, the prison chief for the southern state of Parana, Luiz Alberto Cartaxo, said 21 inmates escaped from the Piraquara prison yesterday after using explosives to break through the prison wall. He said two other inmates died while trying to flee.