A clash between two gangs killed more than 25 inmates in an overcrowded prison in northern Roraima state of Brazil on Sunday, local media reported citing police.
Fights and riots often take place in Brazil's overcrowded prison system which has the world's fourth largest population.
The riot began on Sunday when the inmates from Agricola de Monte Cristo broke into another section of the prison where a different gang were being held.
Some 100 relatives of inmates were taken hostage during the fighting which happened during visiting hours.
Later on Sunday, the Special Operations Police stormed the facility, freed all hostages and ended the insurrection.
"All the hostages were released," Roraima state Secretary of Justice Uziel Castro said.
However the inmates demanded a judge to hear their demands.
Seven of the inmates who were involved in Sunday's riot were beheaded while another six had burned to death, the report said.
According to reports, the prison overburdens its capacity by hosting around 1,400 inmates rather than 740.