At least 52 people have been killed in a prison riot in Brazil which saw rival gangs battle for five hours, officials say.
Gang members from one prison block invaded another part of Altamira jail in Pará state.
Sixteen of the dead were decapitated and the remainder suffocated after part of the prison was set on fire, officials said at a news conference.
Two prison officers who were taken hostage have since been freed.
The violence began at about 07:00 local time (10:00 GMT), and ended at around noon, officials said.
Members of the Comando Classe A (CCA) gang set fire to a cell where rival gang members from Comando Vermelho (Red Command) were kept, the Pará state government said in a statement.
The structure of the cell allowed the fire to spread quickly, resulting in the death by asphyxiation of some inmates.
Officials said that the two prison officers taken hostage were soon released, because the goal of the attack was to strike at the rival gang – rather than at the prison guards.
There had been no prior warning or signs of an impending attack on this scale, the statement said.
Video reported to be from the prison carried by Brazilian media showed smoke billowing from at least one prison building, while another clip appeared to show inmates walking around on the rooftops.
The prison in Altamira where Monday’s violence broke out has a capacity of 200, but was occupied by 309 prisoners. Officials denied it was overcrowded.
Gang leaders involved in the attack were to be moved to federal prisons for isolation, if they were identified.
Violence in Brazilian prisons is not uncommon. The country has the world’s third-largest prison population of some 700,000 people, and overcrowding is a widespread problem.
Clashes between rival gangs are frequent, as are riots.
In May, 40 people were killed on the same day in four different prisons in Manaus in Amazonas state – a day after 15 died in prison fights in the area.
More than 130 people were killed in January 2017 alone, as violence broke out in several prisons between the country’s two largest gangs, resulting in lengthy riots and the eventual transfer of hundreds of prisoners.
Brazil’s far-right President Jair Bolsonaro has vowed to bring in tighter controls in prisons, while building more across the country.
But this will not be straightforward as most prisons are controlled at the state level.
What causes violence in Brazil’s jails?
A crackdown on violent and drug-related offences has seen the country’s prison population boom in recent decades.
Overcrowding makes it hard for prison authorities to keep rival factions separate. It also raises tensions inside the cells, with inmates competing for limited resources such as mattresses and food.
Killings between rival gang members are common in Brazilian prisons.
This was exacerbated when a two-decade truce of sorts broke down in recent years between two of the country’s most powerful gangs – the Sao Paulo-based First Capital Command (PCC) drug gang and Rio de Janeiro’s Red Command.
Lack of resources
Many Brazilian prisons are underfunded.
Poorly-trained and badly-paid prison guards often face inmates who not only outnumber them but who also feel they have little to lose as they face long sentences already.