RIO DE JANEIRO — A fight between rival gangs in a prison in northern Brazil left at least 57 inmates dead, including at least 16 who were decapitated, according to prison officials.

The clash in Pará State was the latest deadly outbreak of violence in Brazil’s overcrowded and riot-prone prisons, which have seen an increase in population in recent years without investment to match.

Powerful drug kingpins often continue to run their criminal organizations from behind bars in the understaffed detention facilities. And while prison officials often segregate rival gangs, feuds frequently erupt into violence. A similar fight at a prison in neighboring Amazonas State in May resulted in the death of 55 inmates.

Officials said inmates at the Regional Recovery Center in Altamira, a city in southeast Pará, held two prison guards hostage during an altercation that began early Monday morning.