An Egyptian court has sentenced 28 people to death over the killing of a top prosecutor two years ago, security and judicial officials said.

The court on Saturday handed other defendants a variety of jail terms up to life in prison.

Hisham Barakat was killed in 2015 when a car bomb struck his convoy in Cairo, an attack for which Egypt blamed the Muslim Brotherhood and Gaza-based Hamas. Both groups denied having a role.

The court sentenced 15 defendants to life in prison, while a further eight received 15 years, and 15 others were handed 10 years, the officials said.

"The verdicts were shocking today," said Ahmed Saad, one of the defence lawyers.

READ MORE: What is it like to live under President Sisi?

"Others who had nothing to do with the assassination of martyr Hisham Barakat received life sentences. They had nothing to do with the incident."

The rulings can still be appealed.

The death sentences have already been approved by the mufti, Egypt's official interpreter of Islamic law, whose opinion is legally required but not binding.

Of the 67 defendants, 15 are still at large.

Egypt has struggled to quell violence by armed groups since the military overthrew Muslim Brotherhood President Mohamed Morsi in 2013 and cracked down on his supporters.

Egyptian courts have sentenced hundreds of Morsi supporters to death since his overthrow, but many have appealed and won new trials.

Morsi and other top figures of his Muslim Brotherhood have also faced trial.