Brazil was hit Friday by its second grisly prison massacre in a week, as inmates beheaded and mutilated fellow prisoners at a northern jail, leaving 31 dead.
Pictures taken by a police officer at the scene showed bloodied, mangled bodies piled in a concrete hallway at the Monte Cristo Farm Penitentiary (PAMC) in Roraima state.
Many of the victims were beheaded, disemboweled or dismembered, officials said.
The state government said the situation was now "under control."
They lowered an earlier death toll of 33 to 31 late Friday.
"No shots were fired. The victims were killed with sharp objects and home-made weapons," said state justice secretary Uziel Castro.
The latest unrest came days after jailed gang members killed 56 rivals in a 17-hour bloodbath Sunday and Monday at a prison in Manaus, the capital of the neighboring state of Amazonas.
Unlike that incident, Friday's violence did not appear to be an all-out riot but rather a rapid, early morning attack by one group of inmates against another, lasting less than an hour, a local government spokeswoman told AFP.
Most of the killings were carried out with knives, she said.
Deadly prison riots have intensified in Brazil since a truce broke down in July between the country's two largest drug gangs, the First Capital Command (PCC) and the Red Command (CV).
PAMC, the largest prison in the state, was also hit by deadly violence in October, when fighting between rival gangs killed 10 inmates.
At the time, the prison held 1,400 inmates - double its capacity.
Authorities said the Manaus riot was caused by a local ally of the Rio de Janeiro-based CV massacring rivals from the Sao Paulo-based PCC.
They said however that Friday's killings appeared not to have been retaliatory, said Justice Minister Alexandre de Moraes.
"It is apparently not a revenge attack by the PCC" for Monday's massacre, after which members of rivals gangs were moved to separate blocks.
Speaking in Brasilia before traveling to the scene, he said PCC members were thought to have attacked prisoners who were not members of any gang.
Castro said it was thought to be "an atrocity committed against regular prisoners."
"The dreadful conditions in the prison are no secret to anyone," he added.
No quick fix
The states of northern Brazil, which border top cocaine producers Bolivia, Colombia and Peru, are battle zones in the drug trade.
Prisons there - and throughout Brazil - are often under the de facto control of drug gangs, whose turf wars on the outside are also fought out among inmates.
Overcrowding exacerbates the problem, activists say.
Brazil's inmate population has been swollen by efforts to crack down on a violent and lucrative drug trade.
The country's jails hold 622,000 inmates, mostly young black men, according to a 2014 justice ministry report, which found that 50 percent more capacity was needed.
After facing criticism for his slow reaction to the Manaus riot, President Michel Temer released a statement Friday saying he "deplores" the latest killings.
On Thursday, he announced the federal government would spend $250 million to build at least one new prison in each of Brazil's 26 states.
But that fails to address the root problem, said sociologist Camila Nunes of the Federal University of ABC in Sao Paulo.
Brazil needs "medium- and long-term policies to reduce the vulnerability of certain social groups, to prioritize prevention rather than repression," she told AFP.
"Supposedly instant solutions like the one that was announced... will not solve the problem. They will just placate public opinion until there's another tragedy."