Twenty-five police officers were sentenced to life in prison on Saturday for their role in the 1992 Carandiru prison massacre that left 111 inmates dead.
The massacre, among the worst mass killings to have taken place in Latin America's notoriously overcrowded prisons, spawned a powerful gang that carried out scores of deadly attacks on police in 2006.
Each officer was sentenced to 624 years in prison for using deadly force to quell a fight among inmates. The court found the officers guilty of killing 52 prisoners.
A seven-person jury reached the sentence, which was read out by the presiding judge early Saturday.
The sentence was reached after a week-long trial, the second part of a process broken into four in which 79 military police officers are accused of killing Carandiru prisoners.
The case was brought to trial in April after more than two decades of procedural delays.
At the time of the massacre Carandiru had 8,000 inmates and was the largest prison in Latin America.
Each trial segment focuses on the killings that took place on each of the four floors of the prison in Sao Paulo on October 2, 1992.
Prosecutors argue that the inmates were executed, while the defense claims police officers were being threatened and fired in self-defense.
Eighty-seven prisoners were wounded in the melee, but the police were unharmed.
In the first phase of the trial, 23 police officers were found guilty and sentenced to 153 years in prison for the deaths of 13 inmates.
The only person previously tried for the massacre was the commander, Colonel Ubiratan Guimaraes, who was sentenced in 2001 to 632 years in prison.
Guimaraes, a former state deputy, appealed the sentence and was absolved. He was found in 2006 shot dead in his Sao Paulo apartment.
The massacre sparked outrage among inmates, and prosecutors said it was a key factor in the establishment of a criminal gang known as First Command of the Capital (PCC) in 1993.
The PCC is believed to have ordered the death of the director of the prison at the time, Jose Ismael Pedrosa.
From the prison, PCC bosses coordinated a series of assaults on police stations and public buildings which left more than 170 people dead and paralyzed Sao Paulo for four days in May 2006.
The violence later spread to other cities, and scores of civilians suspected of criminal activity were gunned down in a subsequent wave of police reprisal attacks.
Late last year, the PCC was also blamed for a wave of police killings and bus burnings.
The Carandiru prison was demolished in 2002.
With a population of 194 million, Brazil has 550,000 people behind bars in more than 1,000 jails, one of the world's largest prison populations.
Some 217,000 detainees are awaiting trial, according to the United Nations.
A UN panel invited by the Brazilian government in late March blamed the problem in part on a judicial culture that sees incarceration as the first recourse, including when minors are involved.
As a result of excessive incarceration, the commission said, "detention facilities were usually overcrowded. In some cases, the number of detainees exceeded the capacity by 100 per cent."