RIO DE JANEIRO/SAO PAULO (Reuters) - Jailed members of Brazil’s most powerful drug gang killed 31 inmates at a penitentiary on Friday, decapitating and cutting out the hearts of most of them, in revenge for a separate prison massacre that left 56 dead this week.

Riot police enter at the public jail in Manaus where some prisoners were relocated after a deadly prison riot in Manaus, Brazil, January 6, 2017. REUTERS/Michael Dantas

The bloodletting in the Monte Cristo prison in the Amazonian state of Roraima, carried out by members of the First Capital Command (PCC) gang, sparked fears that months of violence between criminal groups controlling Brazil’s prisons had spiraled out of control.

The PCC itself was targeted on Sunday in neighboring Amazonas state in Brazil’s worst prison slaughter in more than two decades.

In a cellphone video that circulated widely on social media, self-described PCC members are seen hacking away at bodies littering an outdoor patio inside the prison.

“You killed our brothers, didn’t you? Look here, look what is going to happen you! This is revenge for what you did to our brothers,” a PCC member is heard saying on the video as dozens of bodies lie in thick pools of blood.

One victim, bare-chested and wearing sky-blue surfer shorts, began to move on the ground. The inmate taking the video calls out to fellow gang members “We’ve got a live one!” before another gang member rushes over and cuts off the victim’s head with a white-handled barbecue knife.

State officials said the riot in Roraima’s largest prison was brought under control by elite police forces. Earlier, authorities put the death toll at 33 but by Friday evening lowered that figure to 31 dead. Violence between rival drug gangs at the same jail had already led to 10 deaths in October.

Roraima’s top security official Uziel de Castro blamed Friday’s violence at the state-run prison on the PCC. He later added that it was believed most of the inmates killed Friday were not members of the group responsible for this week’s attack on the PCC in Amazonas and indeed had no gang affiliations.

Justice Minister Alexandre Moraes insisted that the government had control over Brazil’s prison system - the fourth largest in world and home to more than 620,000 inmates.

Slideshow ( 5 images )

Security experts had predicted more violence in Brazil’s gang-controlled penitentiaries in the wake of Monday’s massacre.

“It’s getting really ugly. This situation is clearly snowballing and there is nothing the government can do to stop the violence in the short term,” said Rafael Alcadipani, a public security expert at the Getulio Vargas Foundation think tank in Sao Paulo.

“We are paying the price for 50 years of total neglect of the penitentiary system.”

UNEASY ALLIANCE

In Monday’s uprising, PCC members were attacked by the North Family drug faction, which controls the Anisio Jobim penitentiary in Amazonas, according to officials. North Family is believed to dominate cocaine traffic in Amazonas from Colombia and Peru, according to authorities.

The group is allied with the Rio de Janeiro-based Red Command drug gang, Brazil’s second most powerful faction after PCC.

For more than two decades, PCC and Red Command maintained an uneasy alliance, ensuring that a steady flow of drugs and guns flowed across Brazil’s long jungle border.

But about six months ago PCC and Red Command split, as PCC moved to take control of lucrative drug routes across the border with Paraguay and become Brazil’s dominant gang.

Experts say PCC also has been moving to infiltrate areas in Red Command’s home base of Rio de Janeiro, further stoking a turf war that threatens to spill onto the streets of Brazil’s biggest cities.

Since the split, Red Command has allied itself with smaller regional gangs to confront PCC, primarily in the north and northeast of Brazil, where prison violence boiled over this week.

Alcadipani, the public security expert, said Brazil’s penitentiary system has been “self-regulated” by the gangs and that mass killings were rare until recent months because of a truce between the country’s biggest criminal factions.

“But we see that as soon as we have a gang war, these killings are inevitably going to happen because the state has no control over the prisons,” said Alcadipani.