A riot in an overcrowded prison in northern Brazil has left at least 60 inmates dead, many of them decapitated, officials say.
The unrest in Manaus, in Amazonas state, started on Sunday after a fight between rival gangs, police said.
The violence ended 17 hours later, when the inmates surrendered their weapons and freed unharmed the last of 12 guards they had taken hostage.
Brazil has the world’s fourth largest prison population.
There are some 600,000 inmates in the country, and overcrowding is a serious problem. Reports said the capacity of the Anisio Jobim Penitentiary Centre, the biggest in Amazonas, was for 454 inmates, but it had 1,224 men.
When the riot began, six headless bodies were thrown over the perimeter fence of the prison.
The state public security secretary, Sergio Fontes, said rival gangs operating inside and outside the prison have been fighting for control over drug trafficking.
A violent problem: Wyre Davies, BBC News
Many of Brazil’s notoriously violent jails are, in effect, run by criminal gangs and violence between rival prison gangs is not uncommon.
This latest massacre reportedly involved powerful groups whose leadership is based in the southern cities of Sao Paulo and Rio de Janeiro but whose deadly influence extends in jails throughout the country.
As is often the case, local media reports in Manaus said that rival gang members were brutally tortured after being taken hostage and some were even decapitated before the authorities could regain control.
Brazil has overcrowded jails and allegations of brutality against prisoners by fellow inmates and by prison guards are common.
The violence, he added, appeared to be a message from Family of the North (FDN), a powerful local gang, to rivals from the First Capital Command (PCC), one of Brazil’s largest gangs, whose base is in Sao Paulo, in the south-east.
Mr Fontes called it “the biggest massacre” ever committed at a prison in the state.
“During the negotiations [to end the riot], the prisoners had almost no demands. Their only request was not to be mistreated by the police when they came in,” he told local radio network Tiradentes.
“We think they had already done what they wanted: kill members of the rival organisation and get a guarantee that they would not be beaten by the police. The FDN massacred suspected members of the PCC and other rivals.”
Officials said they were still working to determine whether any prisoners had escaped.
Fights between rival gangs often result in dozens of inmates being killed and sometimes dismembered.
The gang members behind the deadly riots are often from violent inner-city areas of Rio de Janeiro and Sao Paulo who have been transferred to prisons in remote states in order to break up their gangs.
However, the number of deadly riots in these states would seem to indicate that this strategy has not worked according to plan, correspondents say.
In October, at least 25 prisoners were killed in a jail in Boa Vista, in Roraima state, and seven youths also died in a riot in Caruaru in Pernambuco state.