(CNN) -- At least 18 prisoners were killed during a long prison riot and a second, shorter riot in northeast Brazil, officials said Tuesday.
A first riot broke out at the Pedrinhas Penitentiary in Sao Luis, capital of Maranhao state Monday morning and lasted through noon Tuesday, the Maranhao state public safety secretary told CNN. At least 15 inmates were killed during the 27-hour riot, the official said.
During the ordeal, five prison officials were held captive while prisoners negotiated with police. None of them were injured and they were later freed, the public safety secretary said.
On Tuesday, three more prisoners were killed in a second riot that took place in a different building of the prison. Police were able to control that riot before it grew, the official said.
The prisoners were rioting over prison's director, Luis Henrique Pena de Freitas, whom they want replaced. They also were protesting the water supply system at the prison and wanted the speed with which lawsuits from inmates are analyzed to be increased.
The water supply is not working properly, but it is something that officials were already fixing, the safety secretary said. The prisoners want their legal work to be processed faster because they can remain in prison for years waiting for their lawsuits to work their way through the slow judicial system.
Journalist Luciani Gomes contributed to this report.