An uprising in a Brazilian penitentiary in which five inmates were beheaded ended without further bloodshed on Wednesday, authorities said. Negotiators managed to secure the release of 20 prison guards who had been held hostage by prisoners since the uprising broke out at the Presidente Venceslau prison in Sao Paulo state on Tuesday morning, Reuters reported. "It is all under control, the rebellion is over. The last hostages have been freed," a prisons service spokesman said. He did not disclose terms of the negotiations. Police moved into the compound shortly afterward . The uprising erupted when a gang attacked a rival group. Prisoners killed and decapitated five inmates on Tuesday, then displayed the heads on the prison wall and brandished them on poles. Members of the First Capital Command, a drug-trafficking network in Sao Paulo, also took prison guards hostage and threatened to kill them too. Riots and uprisings happen frequently in Brazil's notoriously overcrowded and violent prisons. Presidente Venceslau holds about 780 inmates but has a capacity of 680.