File photo taken on June 18, 2016 shows Egypt's former President Mohamed Morsi (L) in a court in Cairo, Egypt. Egypt's former President Mohamed Morsi died on Monday in court after the conclusion of a trial session in an espionage lawsuit, state-run Ahram reported on its website. (Xinhua/Ahmed Gomaa)
CAIRO, June 17 (Xinhua) -- Egypt's former President Mohamed Morsi died on Monday in court after the conclusion of a trial session in an espionage lawsuit, the state TV reported.
"The former president had asked to speak and the judge gave him the permission," said the state TV.
Morsi fainted later and his body was taken to hospital, it added.
Local media said the former president suffered a heart attack.
He had been attending a retrial session in Cairo criminal court along with 22 other people.
Nabil Sadek, the public prosecutor, said in a statement that Morsi collapsed in a defendants' cage in the courtroom after speaking for five minutes and was pronounced dead in hospital at 4:50 p.m. local time (1450 GMT).
"The initial medical examination of Morsi showed that he had no pulse, no indications of breathing and his eyes were open and unresponsive to light or stimuli," the statement said.
An autopsy showed no signs of recent injury on his body, Sadek said.
Sadek has ordered examination of Morsi's body, the check of footage from surveillance cameras at the court, as well as investigation of those who were present at the time of the former president's death.
According to informed judicial sources, Morsi was treated in accordance with the law while in detention, and was being examined by doctors on a regular basis, state-run Ahram website reported.
Morsi, 67, who took office in 2012, was ousted by the army in 2013 in response to mass protests against his rule.
Since then, Morsi and top leaders of his Muslim Brotherhood group have been kept in prison, facing trials over charges of murder, violence and spy.
Morsi was serving a 20-year jail sentence for inciting deadly clashes between his supporters and opponents in late 2012, and a 25-year jail term for leaking classified documents to Qatar. He denied all these charges.
The Muslim Brotherhood has been outlawed by the Egyptian government since 2014.