Thousands of people have gathered in Cairo to protest against the verdicts on Egypt's former President Hosni Mubarak and his co-defendants.

The 84-year-old was sentenced to life in prison today for complicity in the killing of protesters during the uprising that forced him from power last year.

Egyptian state television reported that Mubarak had suffered a heart attack as he was being transferred from court to a prison in Cairo, and was being treated in a prison hospital.

Former Interior Minister Habib al-Adly was also given a life sentence, but four aides were acquitted.

Protests are also taking place in Alexandria and other cities.

Egypt's Muslim Brotherhood candidate Mohammed Mursi arrived in Tahrir Square to join the demonstrations.

Mr Mursi, who faces Mubarak's last prime minister Ahmed Shafiq in a presidential run off later this month, was surrounded by Muslim Brotherhood youth.

They cleared a path for him as he toured the packed square for about 15 minutes.

After a silence during sentencing, scuffles broke out inside the court between security officers and people chanting "Void, void" and "The people want the cleansing of the judiciary".

Rather than a healing experience that many Egyptians wanted, many saw the trial that acquitted top security officials as showing how much of Mubarak's old order was still in place.

Al Jazeera reported that Mubarak would lodge an appeal ,but his lawyers could not be reached for comment.

Mr Shafiq, appointed premier in the last days of Mubarak's rule and who calls the ex-president a role model, said on his Facebook page the trial showed no one was above the law.

Lawyers acting for the families of victims said the acquittal of the six security officials showed the weakness of the prosecution case. They said the sentence was designed to appease public anger, but could be overturned at appeal.