Rioting inmates who took over most of a prison in Brazil killed five fellow prisoners, beheading at least two of them, before ending the uprising early Tuesday and releasing two hostage guards.
The riot, which erupted Sunday, ended after authorities reached a deal with the prisoners to transfer 850 inmates to other jails from the prison in Cascavel in the southern state of Parana.
Five prisoners were killed and 25 wounded in the violence, said Elson Faxina, a spokesman for the Parana state attorney's office.
"Eight of the wounded are in serious condition and were taken to hospital," he told AFP.
"Early this morning (the rioters) also released the two hostage penitentiary agents after 850 prisoners were transferred to other jails."
After the transfers, the facility now holds less than 300 inmates.
The riot erupted Sunday morning as breakfast was being served.
Inmates overpowered their guards and took two of them hostage, seizing 80 percent of the prison.
Two prisoners were beheaded in the first surge of violence, and two others were thrown off the top of the cellblocks.
Authorities said they were still investigating how the fifth inmate died.
Coroners were working to identify the bodies of those killed.
Some 800 prisoners -- or 80 percent of those at the facility -- took part in the revolt, Faxina said.
An official with the guards' union said only 10 wardens were on duty at the time.
Prison authorities said the inmates were demanding improved facilities, better food and more flexible visiting hours.
But the inmate-on-inmate violence also suggested that rivalries between competing prison gangs played a role, Faxina said.
The state correctional center, which was holding 1,140 inmates, has a capacity for 1,181, according to official data.
But the state guards' union said the true capacity was just 900.
The union said the prison suffered from chronic under-investment and inadequate staffing.
Brazil holds 548,000 inmates in its prisons, but needs 207,000 more spaces to stop overcrowding, according to the advocacy group Conectas Human Rights.