Cairo CNN  — 

Ousted Egyptian President Mohamed Morsy collapsed and died in a Cairo court Monday, soon after making a final statement in his trial on espionage charges.

Egypt’s first democratically elected leader, Morsy, 67, had just been led back to a soundproof glass cage inside the courtroom when he fell unconscious, Egypt’s public prosecution office said in a statement.

“He spoke 7 minutes just before the trial session adjourned,” Morsy’s lawyer Abdel Moneim Abdel Maqsoud told CNN. “A minute after, we saw fuss in the court glass box, we could hear the defendants screaming, Dr. Morsi has fallen,” said Abdel Maqsoud, who is also the lead lawyer for the banned Muslim Brotherhood movement.

Morsy had closed his final statement by quoting a verse of a poem that read, “My country is dear even if it oppressed me and my people are honorable even if they were unjust to me,” Abdel Maqsoud said.

Egypt’s state-run Al Ahram online reported that the former leader suffered a heart attack. He was pronounced dead after arriving at hospital at 4:50 p.m. (10:50 a.m. ET), the prosecutor’s office said. No apparent injuries were found on his body, it added.

On Monday evening, Turkey’s president, Recep Tayyip Erdogan, reacted to the news, calling Morsy a “brother” and a “martyr,” according to state-run news agency Anadolu.

Erdgoan also tweeted about Morsy’s death, saying he had “conducted one of the biggest democratic struggles of the history.”

Morsy was buried in Nasr City, a district in eastern Cairo, alongside other senior figures of the Muslim Brotherhood, his wife Naglaa Mahmoud said on her Facebook page on Tuesday.

Egyptian authorities barred Morsy’s relatives from burying his body in his home province of Sharqiya, Mahmoud said. Family members were allowed to attend the burial, she said.

According to Islamic law and Egyptian tradition, the deceased should be buried as soon as possible. Muslim burial rites are commonly performed the same day or within 24 hours of death.

A polarizing figure

A strict Islamist who was educated in southern California, Morsy was voted into power in June 2012 following the 2011 Arab Spring uprising that toppled Hosni Mubarak’s longstanding rule.

A senior member of the Muslim Brotherhood, Morsy had campaigned on appealing to the broadest possible audience.

But, during his year in power, critics say he became an authoritarian leader who forced through a conservative agenda.

In 2013, Morsy and the political wing of the Muslim Brotherhood movement were ousted in a coup, with the Muslim Brotherhood banned by the government after the military seized power and declared it a terrorist organization.

The Muslim Brotherhood is a religious and political group founded on the belief that Islam is not simply a religion, but a way of life. The group advocates moving away from secularism and returning to the rules of the Quran as a basis for healthy families, communities and states.

The Brotherhood has branches in 70 countries, but not all of the branches operate under the same identity. In Egypt, the group has been part of the political scene for more than 80 years.

The movement officially rejects the use of violent means to secure its goals. However, offshoots of the group have been linked to attacks in the past, and critics blame the Brotherhood for sparking troubles elsewhere in the Middle East.

In August 2013, roughly 1,000 Egyptians – many of them Morsy supporters – were killed during protests against the military government.

Supporters of ousted president Mohamed Morsy demonstrate in Cairo in November 2013.

Following his ouster, Morsy was tried en masse with Mohamed Badie – the spiritual leader of the Muslim Brotherhood – as well as more than 100 alleged members of the outlawed group, according to state media.

In 2015, he was sentenced to death over a jailbreak during the 2011 uprising and to life in prison on espionage charges after being convicted of conspiring with Palestinian group Hamas, the Iranian Revolutionary Guard and other foreign organizations.

Both of those sentences were widely criticized as political grandstanding.

Morsy was also handed a 25-year prison sentence for leaking state secrets to Qatar, and had received an additional 15-year sentence for other, lesser, charges.

In 2016, Morsy’s death sentence and life sentence were overturned.

‘Cruel, inhuman treatment’

Abdel Maqsoud said Morsy had not been allowed to see his lawyers or communicate with the outside world or his family, and that he had been detained in solitary confinement before his death.

Morsy’s son, Abdullah, said the family was denied permission to visit him. “The family was able to see him only three times since 2013,” Abdullah told CNN.

Last year, in a report from a panel commissioned by Morsy’s family and made up of British Parliamentarians said that the conditions of his detention “would constitute cruel, inhuman and degrading treatment,” and “could meet the threshold for torture in accordance (with) Egyptian and International law.” The panel wrote that Morsy is receiving inadequate medical care “which is likely to lead to premature death.”

On Monday, Human Rights Watch (HRW) called Morsy’s death “entirely predictable” accusing the government of failing to allow him adequate medical care while he was in prison.

“At the very least, the Egyptian government committed grave abuses against Morsy by denying him prisoners’ rights that met minimum standards,” said Sarah Leah Whitson, the group’s Middle East and North Africa director.

The Egyptian government said HRW’s statement and reporting was “nothing but political exploitation in the name of human rights” and a “new ethical low.”

Amnesty International said in a tweet that an investigation into Morsy’s death and the conditions of his detention was an “urgent requirement,” citing Egypt’s “proven track record of holding prisoners in solitary confinement for long periods and in harsh conditions.”

In a statement on Monday, the Muslim Brotherhood said it held Egyptian President Abdel Fattah el-Sisi and his regime “accountable for the killing of the elected legitimate president, politically and criminally,” and demanded an independent review into the circumstances of Morsy’s death.

The group has called for demonstrations outside Egyptian embassies around the world at 10 p.m. local time (4 p.m. ET).

Egyptian state media Al-Ahram reported Monday that Morsy was regularly examined by doctors and “was treated in accordance with the law while in detention.”

Journalist Magdy Samaan reported from Cairo while CNN’s Kara Fox wrote from CNN. CNN’s Vasco Cotovio and Ruba Alhenawi contributed to this report.