The latest in a string of brutal prison massacres involving suspected gang members in Brazil has killed 26 inmates, most of whom were beheaded, officials said.
The bloodbath erupted Saturday night in the overcrowded Alcacuz prison in the northeastern state of Rio Grande do Norte.
Similar violence at other jails in Brazil left around 100 inmates dead in early January.
"Twenty-six deaths have been verified," the state's public safety manager, Caio Bezerra, told a news conference. The authorities had earlier estimated around 30 were killed as they gathered bodies and body parts, he said.
Security forces stormed the prison at dawn and restored order after 14 hours of violence, the local authorities said.
Officials said members of two drug gangs clashed violently after coming out of different parts of the prison.
One family member said the authorities did not seem to be doing everything they could — even after she warned the prison director.
"The (prison) director even said he could not do anything" when told an uprising was looming, said Adriana Feliz, the sister an inmate.
"I told the director they were going to go in and kill everyone in Pavillion 4," she added. "So why didn't they do anything?"
President Michel Temer said on Twitter that the federal government stood ready to provide "all assistance necessary."
Separately, officials in the southern state of Parana said 28 prisoners escaped from a jail in the city of Curitiba after inmates blew up a wall and fired on police.
– Prisoners armed –
At Alcacuz, security forces surrounded the prison but had to wait until first light Sunday to storm the site with armored vehicles, officials said.
Prisoners had cut off the electricity and were said to have firearms.
The prison, just outside the state capital Natal, was built for a maximum of 620 inmates but currently houses 1,083, the state justice department said.
The riot was thought to have been a clash between Brazil's biggest drug gang, the First Capital Command (PCC), and a group allied to its main rival Red Command, Brazilian media said.
Experts say the violence is part of a war between drug gangs battling for control of one of the world's most important cocaine markets and trafficking routes.
– Drug gang war –
Violence in the first week of January left around 100 prisoners dead — many of them active gang members, the authorities said.
Many of the victims were beheaded, disemboweled or dismembered, officials said.
The biggest bloodbath, in the northwestern city of Manaus, left about 60 inmates dead. It appeared to be an orchestrated mass killing targeting members of the PCC. Dozens of inmates are still missing.
A second bout of violence in Roraima state killed 33.
It was thought to be a backlash by the PCC's rivals for its violent expansion.
The states of northern Brazil, which border top cocaine producers Bolivia, Colombia and Peru, are battle zones in the drug trade.
Prisons there — and throughout Brazil — are often under the de facto control of drug gangs, whose turf wars on the outside play out among inmates.
– Overcrowding –
Overcrowding exacerbates the problem, activists say.
Brazil's inmate population has been swollen by efforts to crack down on the drug trade.
The country's jails hold 622,000 inmates, mostly young black men, according to a 2014 justice ministry report. It found that 50 percent more capacity was needed.
Brazil has the world's fourth-largest prison population after the United States, China and Russia, according to the report.
Temer is under pressure over the issue.
After the two riots earlier this month, he announced the federal government would spend $250 million to build new prisons.
But human rights activists and experts questioned whether more prisons are the answer.
Brazil needs "medium- and long-term policies to reduce the vulnerability of certain social groups, to prioritize prevention rather than repression," sociologist Camila Nunes of the Federal University of ABC in Sao Paulo told AFP after the previous prison massacres.