At least 52 prison inmates have been killed in riots Monday in northern Brazil, authorities said.

Gang members of one part of the Altamira jail invaded another portion of the prison, with parts of the prison even being set on fire. The violence lasted more than five hours while the fires made it more difficult for authorities to enter the facility.

Of the more than 52 that died, 16 were decapitated, while the others suffocated from the fire.

The BBC reported that two prison officers were later freed after being taken hostage.

The Altamira prison was overcrowded, holding 311 prisoners in a facility with a maximum occupancy of 200.

A similar incident happened in May, when 55 inmates were killed in four Brazilian prisons in the western state of Amazonas.

There are currently 750,000 prison inmates in total in Brazil, the third-highest prison population in the world.

Violence is not uncommon in Brazilian prisons, with rival gangs often fighting against each other.

In January 2017, almost 150 people were killed as opposing gangs clashed during prison uprisings. One prison riot in the Amazon city of Manaus killed 60 people within one week.

Human Rights Watch (HRW) has conducted research showing that some Brazilian prisoners join gangs for protection and claimed that the gangs themselves run some prisons rather than the Brazilian authorities.

Brazilian President Jair Bolsonaro, elected in October 2018 on a platform of cracking down on crime, wants to implement stricter restrictions to control the prisons. Bolsonaro's administration may face roadblocks with his reforms, as prisons are controlled on a state-level but not federally.