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 on Saturday night in the overcrowded Alcacuz prison in the northeastern state of Rio Grande do Norte.

"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.

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.

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 of 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. At Alcacuz, security forces surrounded the prison but had to wait until first dawn on Sunday to storm the site with armoured 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. 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 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. Another 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 exacerbates the problem, activists say.