At least 57 prisoners have been killed by other inmates during clashes between organised crime groups at Altamira prison in northern Brazil, according to officials.
Para state prison authorities said 16 of the victims were decapitated while others were asphyxiated.
The death toll could rise when authorities have searched all areas involved, state prisons chief Jarbas Vasconcelos said at a news conference.
Prison authorities said a fight erupted at around 7am between the Rio de Janeiro-based Comando Vermelho and another group, Comando Classe A.
“We was a targeted attack. The aim was to show that it was a settling of accounts between the two groups.”
“Leaders of the (Comando Classe A) set fire to a cell belonging to one of the prison’s pavilions, where members of the (Comando Vermelho) were located,” the statement read.
Mr Vasconcelos said the fire spread rapidly, with inmates held in old container units that had been adapted for the prison while another building is under construction.
The fire prevented police forces from entering the building for about five hours, he said.
Two prison staff members were held hostage, but eventually released.
“It was a targeted attack. The aim was to show that it was a settling of accounts between the two groups, not a protest or rebellion against the prison system,” Mr Vasconcelos said.
Authorities have not found any firearms following the riot, only makeshift knives.
Prison authorities said they were still trying to determine who were the leaders behind the attack, and those men will be transferred to federal prisons.
President Jair Bolsonaro was elected on the promise of curbing widespread violence in Brazil, including in the country’s often overcrowded, out-of-control prisons.
State authorities deny the facility was overcrowded, but the Associated Press obtained a report from the National Justice Council that it says was filed by a local judge in charge of the facility, showing that the prison had 343 detainees for a maximum capacity of 163.
He described the state of the prison in the city of Altamira as “terrible”.
In many of Brazil’s prisons, badly outnumbered guards struggle to retain power over an ever-growing population of inmates who run criminal activities from behind bars.
The killings echoed those of 55 inmates who died in a series of riots in May in several prisons in the neighbouring state of Amazonas.
In early 2017, more than 120 inmates died in prisons across several northern states when rival gangs clashed over control of drug-trafficking routes in the region. The violence lasted several weeks, spreading to various states.
Prison authorities said they had not received any prior intelligence reports of an upcoming attack.