The Brazilian government will relocate gang leaders to other federal penitentiaries after the country’s deadliest prison massacre in decades left 56 inmates dead in a scene of mutilated and burned bodies this week, officials said on Tuesday.

Justice Minister Alexandre de Moraes said authorities would move quickly to identify and transfer the gang bosses out of the crowded jail in the remote jungle state of Amazonas where the riot occurred on Monday.

A local drug gang known as North Family, which controls the prison complex in the city of Manaus, attacked inmates from a rival criminal group that encroached on its turf, exchanging fire with police and taking a dozen prison guards hostage, officials said.

Machete-wielding gangs decapitated inmates and threw their bodies over a wall of the Anisio Jobim prison, which houses more than three times as many prisoners as it was built for in 1982.

The riot was the deadliest since the 1992 rebellion at the Carandiru prison in Sao Paulo state in which 111 inmates were killed.

Police hunted for more than 100 inmates who escaped from the prison during the riot, which lasted about 17 hours.

An escalating war for control of the lucrative drug trade between rival gangs has fueled more violence in recent months in Brazil’s overcrowded and understaffed prisons, home to an estimated 600,000 prisoners.

Amazonas state authorities will move dozens of inmates from other prisons to an abandoned jail in Manaus to protect them from rival gangs amid fear that Monday’s massacre could lead to retaliation.

Four inmates were found dead in another prison in the rural area of Manaus on Monday. State officials were not able to say whether there had been a riot there.