Natal (Brazil) (AFP) - Brazilian police cleared several dozen inmates from the roof of a prison where dozens were murdered over the weekend -- the latest in a series of deadly riots.

The prisoners had on Monday clambered onto the roof of the Alcacuz penitentiary near the northeastern city of Natal.

An AFP video reporter filmed the inmates standing for hours with flags on the partly destroyed red tile roof before police chased them down.

Officers also fired rubber bullets at relatives who had crowded in front of the prison's entrance, an AFP journalist saw.

In a violent riot that broke out Saturday night a total of 26 prisoners were killed in Alcacuz -- many of them beheaded, officials said.

The cells were not closed for the night because the bars on them had been ripped off in a previous riot in 2015 and not replaced.

On Sunday, police stormed the prison and ended the uprising.

- Rival drug gangs -

It was the third major massacre to hit Brazil's overcrowded jails this month, all of them thought to involve suspected drug gangs.

Officials said two rival gangs clashed in the overcrowded Natal jail.

Separately the state government said prisoners rioted early on Monday morning at another jail in the Raimundo Nonato prison, also in Natal.

No one was hurt or escaped in that riot, which was quelled by police, it said.

More violence broke out later in the day at the Dutra Ladeira jail in the southeastern city of Belo Horizonte.

A group of prisoners burned mattresses and threatened to kill "many people," although no one was reported injured or escaped, Globo News said.

Gruesome violence at a prison in the northwestern city of Manaus killed about 60 inmates on January 1. Many prisoners were beheaded and mutilated.

A further 33 died in a riot in Roraima state on January 6.

The Natal massacre raised fears that the wave of violence could spread across the country.

"Authorities are playing a dangerous game by underestimating the scale" of the crisis in the prison system, said Renata Neder, a human rights adviser to Amnesty International in Brazil.

Story continues

The rights watchdog on Monday called for an independent inquiry into the killings.

President Michel Temer said on Twitter that the federal government stood ready to provide "all assistance necessary" to quell the prison unrest.

- Overcrowded prisons -

At Alcacuz, security forces surrounded the prison but had to wait until first light Sunday to storm the site with armored vehicles, officials said.

Prisoners had cut off the electricity and were said to have firearms.

The prison was built for a maximum of 620 inmates but currently houses 1,083, the state justice department said.

After the two riots earlier this month, Temer announced the federal government would spend $250 million to build new prisons.

The justice ministry had already announced a reform of the penitentiary system, in which nearly half those locked up have not been sentenced but are awaiting trial.

The latest riot was thought to have been a clash between Brazil's biggest drug gang, the First Capital Command, and a group allied to its main rival Red Command, Brazilian media said.

Experts say the violence is part of a war between drug gangs battling for control of one of the world's most important cocaine markets and trafficking routes.

Brazil shares borders with Colombia, Bolivia and Peru, the world's three biggest cocaine producers. It serves as an important transit point for the narcotic on its way to Europe, often on board cargo ships that stop over in Africa.