A prison riot, which took place over the weekend in northeastern Brazilian state of Bahia and resulted in the deaths of eight inmates, ended with negotiations on Monday.

The fight that led to the riot started out late Sunday night as an altercation between two rival gangs in the Feira de Santana regional prison and swiftly escalated to a hostage situation involving around 70 people.

The Feira de Santana regional prison, having been designed to house 644 inmates and holding 1,467, is notoriously overcrowded. The overcrowding of Brazilian prisons is considered a primary factor in the common occurrence of prison rioting in the Latin American country. According to Human Rights Watch, “Severe overcrowding is perhaps the most basic, and most chronic, problem plaguing Brazil's penal system.”

Cleriston Leite, the prison director at the Feira de Santana regional prison, said that the initial fighting that led to a the deadly events came after the the deaths of two ringleaders of rival gangs.

Aside for the eight inmates killed, five were injured. The injured inmates were released and then taken to a local hospital for care.

As reported by Fox News, the prison directors stated that a commission of councilors as well as representatives of human rights organizations had managed to come to an agreement with the rioting prisoners, which led to a gradual release of the hostages and the eventual entry of police.

The uprising occurred when a group of inmates took hold of family members, including women and children, in an effort to keep them from leaving the prison.

Preliminary reports indicated that seven prisoners were killed, but another death was later confirmed. One of the dead was decapitated.

As noted in The Associated Press, prison riots happen with regularity in Brazil and often lead to multiple deaths.