Updated

Mohamed Morsi, the former president of Egypt and top Muslim Brotherhood official who was ousted by the military in 2013 and had been standing trial for espionage, collapsed and died during a court session Monday, state television reported.

Morsi, 67, was in court when he suddenly blacked out and then died, according to state television.

An Egyptian judicial official told the Associated Press that 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 before collapsing minutes later.

EGYPT AGREES TO PAY ISRAEL $500 MILLION TO END GAS DISPUTE

Morsi, a top figure in Egypt's largest Islamist group -- the now outlawed Muslim Brotherhood -- was elected president in 2012 in the country's first free elections following the ouster the year before of longtime leader Hosni Mubarak.

In this 2015 photo, Egypt's deposed president Mohamed Mursi greets his lawyers and people from behind bars at a court hearing. (REUTERS/Amr Abdallah Dalsh/File Photo)

But the military ousted Morsi in 2013 after massive protests and crushed the Brotherhood nationwide in a major crackdown, arresting Morsi and many other group leaders.

He had been serving a seven-year prison sentence for falsifying his candidacy application for the 2012 presidential race, according to Reuters. Monday's session was part of a retrial, being held inside Cairo's Tura Prison, on charges of espionage with the Palestinian Hamas militant group.

Mohammed Sudan, leading member of the Muslim Brotherhood in London, described Morsi's death as "premeditated murder" saying that the former president was banned from receiving medicine or visits and there was little information about his health condition.

On Monday, Egypt's state TV said that the country's ousted President Mohammed Morsi has collapsed during a court session and died. (AP Photo/Maya Alleruzzo)

"He has been placed behind glass cage (during trials). No one can hear him or know what is happening to him. He hasn't received any visits for a months or nearly a year," he told the Associated Press. "He complained before that he doesn't get his medicine. This is premeditated murder. This is slow death."

The judicial official said Morsi had asked to speak to the court during the session. The judge permitted it, and Morsi gave a speech saying he had "many secrets" that, if he told them, he would be released, but he added that he wasn't telling them because it would harm Egypt's national security.

A lawyer representing Morsi said his client was "calm and organized" ahead of the hearing, Sky News reported.

"He summarised our argument in three to five minutes," his lawyer said. "He insisted on a special tribunal as he is the president of the republic."

Egypt's chief prosecutor, Nabil Sadek said in a statement that authorities are examining the circumstances in the dramatic courtroom death and have seized surveillance cameras in addition to ordering Morsi's medical report. Sadek added that a team of forensic experts is being assembled to examine Morsi's body to determine the cause of his death.

CLICK HERE FOR THE FOX NEWS APP

Since Morsi's ouster, Egypt's government has declared the Brotherhood a terrorist organization and largely crushed it with a heavy crackdown. Tens of thousands of Egyptians have been arrested since 2013, mainly Islamists but secular activists who were behind the 2011 uprising.

The 67-year-old had been sentenced to 20 years after being convicted of ordering Brotherhood members to break up a protest against him, resulting in deaths. An earlier death sentence was overturned but multiple cases are still pending.

Morsi was held in a special wing in the sprawling Tora detention complex nicknamed Scorpion Prison. Rights groups say its poor conditions fall far below Egyptian and international standards.

The Associated Press contributed to this report.