Authorities say the prisoners found dead in the Amazonas state showed signs of asphyxia and stab wounds.
At least 57 prisoners have been killed by other inmates during clashes between organised crime groups at the Altamira prison in northern Brazil, according to officials.
Para state prison authorities said 16 of the victims were decapitated during Monday’s incident, while others suffocated after the prison buildings were set on fire.
The fight between rival groups erupted around 7 am local time (10:00 GMT), between the Rio de Janeiro-based Comando Vermelho and a local criminal group known as Comando Classe A.
“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.
State prisons chief Jarbas Vasconcelos said the fire had 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 several hours, he told a news conference.
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,” Vasconcelos said.
No firearms were found at the scene, but improvised knives appear to have been used in the turf war, according to prison authorities.
Brazilian TV stations showed footage of thick black smoke rising from the prison compound and people sitting on the roof of a building.
Other images showed flames inside a building that almost reached the ceiling and people, apparently prisoners, sitting on the ground outside.
Some of the bodies had not yet been recovered due to the heat inside some of the prison structures.
The Ministry of Justice and Public Security said ringleaders of the violence would be transferred to federal jails, which are more secure. About 311 prisoners were being held at the jail, which the department said was not overcrowded. It reportedly has a capacity for 200 inmates.
The killings echoed violence in May when 55 inmates died in a series of riots 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.
Al Jazeera’s Teresa Bo, reporting from Buenos Aires in neighbouring Argentina, said that this type of prison riots were “very common in northern Brazil mostly because it has the world’s third-largest prison population”.
“The situation in the prisons with overcrowding, violence and inhumane conditions is what makes the situation even worse and that’s why in a way gang members use brutal ways in order to send message to those from rival organisations,” she said.
“The government has taken immediate action in order to solve the situation, increase security, intelligence among other things, but they do not solve the real problems in the prisons which is mostly overcrowding and shortages of staff.”
Brazil has 726,712 inmates as of June 2016, according to official statistics.
The population is double the capacity of the nation’s prisons, which in the same year was estimated to be 368,049 inmates.
Jeffrey Lesser, the director of the Claus M Halle Institute for Global Research at Emory University, told Al Jazeera that the harsh conditions in prisons offer little room for the inmates’ rehabilitation.
“The prisons themselves are the opposite of rehabilitation. They are taking young people and making them into hardened criminals and that is in part because Brazil has in some ways an extremely weak state and because the state is weak, the criminal gangs expand,” he said from the city of Sao Paulo in Brazil.