The unrest in Manaus, in Amazonas state, started on January 1 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 Brazil, 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. Pictures showed bloodied and burned bodies stacked in a concrete prison yard and piled in carts.
The state public security secretary, Sergio Fontes, said rival gangs operating inside and outside the prison had been fighting for control over drug trafficking.
According to Sergio Fontes, the violence 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.
He called it “the biggest massacre” ever committed at a prison in Amazonas.
The inmates got weapons through a hole in a prison wall, he added. Several firearms were found in the post-riot search by police, as well as several tunnels.
Prisoners at a second jail unit nearby also rioted and many escaped, Sergio Fontes said. Some 40 inmates had been recaptured, he added. It was unclear how many remained at large.
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.
This was the deadliest prison riot in Brazil since 1992, when a rebellion at the Carandiru prison in Sao Paulo saw 111 inmates killed, nearly all of them by police as they retook the jail.
Image source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…