CARACAS, Venezuela (AP) — Officials pointed fingers at each other Thursday over who bore responsibility for clashes between inmates and security forces that left 37 people dead in a small prison in southern Venezuela.

Interior Minister Nestor Reverol said federal authorities were forced to take action after the Amazonas state governor failed to resolve a crisis at the prison in Puerto Ayacucho. He said Gov. Liborio Guarulla, a member of the opposition, had let the jail descend into "a chaos in the hands of gangs."

"We are closing this prison in order to rehabilitate it," he said, adding that prisoners were being transferred to other facilities.

The governor put the blame on the special forces troops that entered the Judicial Detention Center late Tuesday in an apparent bid to wrest back control from inmates. He had told The Associated Press on Wednesday that inmates seized the prison's interior in recent weeks,

Guarulla remarked on Twitter that Venezuela's ruling socialist party had begun its campaign for the Amazonas governorship with a "massacre." He tweeted a gruesome photo of bloodied bodies piled on top of each other.

Reverol said inmates were armed with rifles and at least 20 grenades. The incident marked the deadliest prison violence in Venezuela since a 2013 riot that killed 61. Many of Venezuela's jails are dominated by gangs that traffic drugs and weapons.

Such power squabbles are not uncommon in Venezuela's 30 prisons, many of which also suffer from overcrowding. But officials said the facility in Puerto Ayaucho near Venezuela's border with Colombia only held slightly over 100 inmates, all of them awaiting trial.

Families of the prisoners were still waiting Thursday for the remains to be identified.

The governor told local media that the area's hospital had been overwhelmed by the number of bodies. Pathologists were being sent from Caracas to assist in identifications.