Ousted Egyptian president and Muslim Brotherhood leader Mohamed Morsi collapsed and died in court during a trial on Monday, according to state television and members of his family.

The 67-year-old Morsi had just addressed the court, speaking from the glass cage he is kept in during sessions and warning that he had “many secrets” he could reveal, said a judicial official, per the Associated Press. A few minutes afterward, he collapsed, the official said, speaking on condition of anonymity because he was not authorized to talk to the press.

State TV said Morsi died before he could be taken to the hospital.

Morsi has been in prison undergoing multiple trials ever since the military ousted him in July 2013. Monday’s session was part of a retrial held inside Cairo’s Tura Prison for charges of espionage with the Palestinian Hamas militant group.

Morsi’s son, Ahmed, confirmed the death of his father in a Facebook post.

Morsi was a longtime senior figure in Egypt’s most powerful Islamist group, the Muslim Brotherhood. He was elected in 2012 in the country’s first free presidential election, held a year after an Arab Spring uprising ousted Egypt’s longtime authoritarian leader Hosni Mubarak. His Muslim Brotherhood also held a majority in parliament.

The military, led by then-Defense Minister Abdel Fattah al-Sisi, ousted Morsi after massive protests against the Brotherhood’s domination of power.

Since Morsi’s ouster, Egypt’s government has declared the Brotherhood a terrorist organization and largely curtailed its influence. Tens of thousands of Egyptians have been arrested since 2013, mainly Islamists but secular activists who were behind the 2011 uprising.

Saudi Arabia and the United Arab Emirates have also designated the group a terrorist organization.

In April, the New York Times reported el-Sisi urged President Donald Trump to label the Muslim Brotherhood a terror organization. Saudi Arabia and the United Arab Emirates have waged their own blacklist campaigns against the group as well.

The Associated Press contributed to this report.