File photo: Independent Media

RIO DE JANEIRO - At least 52 people were killed in a prison riot Monday in northeastern Brazil, authorities said, the second time in little more than two months that a clash between rival gangs resulted in a horrifying bout of violence.

At least 16 of the victims were decapitated, authorities said. Others were asphyxiated.

It took five hours for prison officials to quell the riot at the Altamira jail in Para state. The clash erupted early Monday after members of one gang infiltrated another part of the jail. Video and pictures aired by local media showed flames shooting out of the prison.

Inmates took two prison officials as hostages. They were reportedly freed unharmed. Authorities have not named the gangs involved.

The clash mirrored a prison riot in northwestern Brazil on May 27, when a power struggle involving the Northern Family, Brazil's third-most powerful gang, led inmates to strangle or stab at least 55 people, some in front of visiting families.

The violence illustrated the mounting insecurity in Brazil's notoriously troubled and overcrowded prisons. The prison population swelled from about 500,000 inmates a decade ago to an estimated 841,000 last year.

President Jair Bolsonaro, elected last year on promises to crack down on violent crime, has described plans to "stuff prison cells with criminals."

"I'd rather a prison cell full of criminals than a cemetery full of innocent people," he said. "We will build more if necessary."

The Altamira was already over capacity, according to local media. It was built for 200 detainees, but currently houses 311.

Unconfirmed images and video on social media appeared to chaos at the prison, with black smoke billowing out from inside the prison walls. People can be seen running around inside. One video appeared to show decapitated heads piled up against a wall.

The Washington Post