BRASILIA (Reuters) - Drug gangs sparked a prison riot that killed 56 people, with decapitated bodies thrown over prison walls in the bloodiest violence in more than two decades in Brazil’s overcrowded penitentiary system, officials said on Monday.

Sergio Fontes, the security chief for Amazonas state, told reporters several decapitated bodies were thrown over the wall of the prison in the Amazon city of Manaus, with most of those killed coming from the Sao Paulo-based First Capital Command (PCC) drug gang.

“This was another chapter in the silent and ruthless war of drug trafficking,” he said.

Justice Minister Alexandre de Moraes traveled to Manaus on Monday to meet Amazonas Governor José Melo Oliveira and other federal security officials about the riot.

Pedro Florencio, the Amazonas state prison secretary, said the massacre was a “revenge killing” in a feud between criminal gangs in Brazil.

The violence began late Sunday and was brought under control by around 7 a.m. AMT (1100 GMT) on Monday, Fontes said.

Just as the riot began in one unit of the Anisio Jobim prison complex, dozens of prisoners in the second unit started a mass escape in what authorities said was a coordinated effort to distract guards.

Overcrowding is extremely common in Brazil’s prisons, which suffer endemic violence and what rights groups call medieval conditions with food scarce and cells so packed that prisoners have no space to lie down.

The Anisio Jobim prison complex currently houses 2,230 inmates despite having a capacity of only 590.

Hours after the Anisio Jobim prison revolt ended, prisoners at an adjoining detention center began a riot and attempted to escape. Authorities said the situation was quickly brought under control.

Watchdog groups sharply criticize Brazil for its prisons, where deadly riots routinely break out.

“These massacres occur almost daily in Brazil,” said Father Valdir Silveira, director of Pastoral Carceraria, a Catholic center that monitors prison conditions in Brazil. “Our prisons were built to annihilate, torture and kill.”

A total of 184 inmates escaped, with 40 recaptured by Monday afternoon.

Slideshow ( 8 images )

The violence was the latest clash between inmates aligned with PCC, Brazil’s most powerful drug gang, and a Manaus criminal group known as the North Family.

The Manaus-based gang is widely believed to be attacking PCC inmates at the behest of the Rio de Janeiro-based Red Command (CV) drug gang, Brazil’s second largest.

Four inmates were later found dead in another prison in the rural area of Manaus, but state representatives were unable to clarify if a riot had occurred.

Slideshow ( 8 images )

BROKEN TRUCE

Security analysts have said that a truce that held for years between the PCC and CV was broken last year, resulting in months of deadly prison battles between the gangs and sparking fears that chaos would spread to other prisons.

In the latest riot, a group of inmates exchanged gunfire with police and held 12 prison guards hostage late on Sunday in the largest prison in Manaus, an industrial city on the banks of the Amazon River, Globo TV reported.

Fontes said 74 prisoners were taken hostage during the riot, with some executed and some released.

A video posted on the website of the Manaus-based newspaper Em Tempo showed dozens of bloodied and mutilated bodies piled on the prison floor as other inmates milled about.

Sunday’s riot was the deadliest in years. A 1992 rebellion at the Carandiru prison in Sao Paulo state saw 111 inmates killed, nearly all of them by police retaking the jail.

Maria Canineu, director of Human Rights Watch for Brazil, said the most recent violence was the result of “no government in 20 years giving much attention to the penitentiary system.”

Canineu said it has been difficult for years for states to receive any funding help from the federal government for prisons.

President Michel Temer announced last week that the federal government would furnish states with 1.2 billion reais ($366 million), mostly to improve infrastructure and security in existing prisons and to build new ones.

($1 = 3.2744 reais)