Riot police officers check inmates after clashing between rival criminal factions at a prison in Boa Vista, Brazil, Oct. 17, 2016. Reuters

Massive riots erupted in two Brazilian prisons, leaving at least 18 dead as inmates set fires and went to war with officials and each other, Agence France-Presse reported Monday.

The violence began Sunday in Angricola de Monte Cristo prison in Boa Vista, the capital city of the northern Roraima state, when inmates targeting a rival gang broke into another wing. Members of the Primerio Comando da Capital faction stormed the area armed with knives, stones and makeshift weapons in order to confront followers of the Comando Vermelho faction. The fighting saw 10 prisoners killed, including at least six who were decapitated and set on fire.

"The inmates were armed with stones and pieces of wood that they ripped from the walls. They used those bits of wood to decapitate their rivals. It was very brutal," regional government spokesperson Jessica Laurie told AFP.

The clashes took place during visiting hours and over 100 relatives, mostly women, were taken hostage, city officials said, Globo TV's website GI reported. Rioting inmates demanded that a judge be brought to the prison to hear their demands. Special Operations Police were called in and were able to free the hostages and regain control.

Another uprising Monday in the Porto Velho state pentitentiary, located in the western state of Rondonia, killed at least 8 inmates. Prisoners of the psychiatric ward set fire to mattresses and burned down the wing in an attempt to escape. Inmates reportedly aspyxiated, while others were being hunted down by helicopter.

"There are thought to be eight people dead but the bodies are burnt and the medical authorities will have to confirm" the toll, a local police spokersperson told AFP.

Brazil's jail conditions have been criticized by human rights groups. The number of incarcerated adults increased by 80 percent in the last decade alone, exceeding 600,000, over 60 percent more than the system's maximum capacity, Human Rights Watch found in its 2016 country report. The international organization also found rampant overcrowding, disease and violence, claiming that prison authorities often ceded power to certain prisoners, who routinely misuse their influence.

In September, 200 inmates escaped from the Jardinopolis prison in the Sao Paulo state after massive riots, in which prisoners set fire to cells and knocked down a large security fence. Around half were recaptured within hours.