CAIRO (Reuters) - An Egyptian court on Sunday upheld the death penalty for 20 men charged with killing policemen in the violence that followed the military’s ousting of an Islamist president in 2013, while changing the sentence for many others to hefty prison terms.

The verdicts can again be appealed.

The case involves 156 people on trial and is known as the “Kerdasa incident” in reference to the pro-Muslim Brotherhood neighborhood where the violence took place in the Giza province adjacent to Cairo.

Islamist gunmen fired rocket propelled grenades at a police station in Kerdasa on Aug. 14, 2013, and slit a policeman’s throat before burning the building down, hours after security forces violently dispersed two protest camps, killing hundreds.

“The crimes the defendants are accused of were committed by a group charged with carrying them out,” said Judge Sherine Fahmy before reading out the verdict.

“Some committed murder themselves, others stole, or burned, some guarded the road so the assailants could commit their crimes, and some blocked the roads to prevent help from coming, some incited citizens against the military and police using mosque speakers and microphones on the streets. If it were not for all of that, these crimes would not have been committed.”

The court also sentenced 80 people to life in prison and 34 to 15 years in jail. One minor was sentenced to 10 years in prison and 21 people were acquitted.

A different court had initially sentenced 183 people to death, including 28 in absentia, and a minor to jail for 10 years in 2015 for the murder of 11 policemen. Those sentenced in absentia are automatically retried if they hand themselves in.

The defendants appealed and the Court of Cassation, Egypt’s highest criminal and civil court, ordered a retrial of the 156 who are in custody. Egypt’s legal system allows the defendants a second and final appeal following Sunday’s verdict.

Egypt’s military, led by General Abdel Fattah al-Sisi, ousted former president Mohamed Mursi of the Muslim Brotherhood in July 2013 following mass protests against his rule. Sisi was elected president a year later.

Supporters of Mursi and the Brotherhood, the world’s oldest Islamist movement, staged two sit-ins in protest until security forces broke them up on Aug. 14, killing hundreds and jailing thousands.