Egypt’s former President Mohammed Morsi, who was ousted by the army in 2013, has died after fainting in a courtroom, the country’s national television has reported.

A former top figure in the now-banned Islamist movement Muslim Brotherhood, Morsi was in court for a hearing on charges of espionage. He was 67.

Morsi was overthrown following mass protests a year after he took office as the country’s first democratically elected leader.

He had remained in custody since then.

The hearing in the capital, Cairo, was related to charges of espionage emanating from suspected contacts with the Palestinian Islamist group Hamas, according to state television.

-Agencies