Sao Paulo, Brazil - A prison riot in the Brazilian Amazon has left at least 56 people dead with some bodies decapitated and burned, officials said.

The riot erupted on Sunday afternoon and lasted for 17 hours in the Anisio Jobim Penitentiary Complex (Compaj) in Manaus, the capital of Amazonas state.

The rioters took 12 guards hostage and a still unconfirmed number of prisoners escaped.

"What happened in Compaj is another chapter of the war that drug trafficking imposes in this country and shows that this problem cannot be faced only by [Brazilian] states," said Sergio Fontes, head of public security for Amazonas.

He called the riot "the worst massacre in the history of the state's penitentiary system".

Fontes's department lowered the death toll to 56 from an earlier count of 60.

Fontes said at a press conference, the state requested support from Brazil's federal government for help to combat drug trafficking and strengthen the security of prison units.

"It is not only a problem of the penitentiary system and it is not an isolated case in the country, but much greater since the dispute inside the prisons is an extension of the war that also happens outside," he said.

The killings occurred over a feud between rival criminal factions, the Sao Paulo-based First Capital Command (PCC) and a local Amazonian crime group Family of the North (FDN), who are engaged in a long-term dispute over controlling prisons, drug trafficking routes, and territory in the region, which is reeling from drug violence.

"One group is trying to eliminate the other so they can dominate the prison system," said Marluce da Costa Sousa, coordinator of the Amazonas state branch of Pastoral Carceraria - a prisoner advocate group linked to the Catholic church.

"It's about profit," she told Al Jazeera.

Amazonian public security authorities confirmed that firearms were used during the riot and inmates exchanged gunfire with police officers.

In October, 25 deaths were reported following prison riots in Roraima state and were attributed to gang warfare.

"Going forward, we can expect to see more prison riots as the prisons have to adjust for the new regime," said Rafael Salies, director of Brazilian operations at Southern Pulse, a risk advisory firm specialising in Latin American public security.

READ MORE: Dozens killed in prison riot in Brazil city of Manaus

With more than 600,000 inmates, Brazil has the fourth largest prison population in the world after the United States, China, and Russia and its prisons have long been denounced by human rights groups for violence and serious overcrowding.

The riot led to the biggest number of prison deaths in Brazil since the 1992 Carandiru massacre in Sao Paulo, when 111 prisoners, many unarmed, were killed - almost all by military police - when they stormed the prison following a riot.