While attending a court session on a charge of treason, Egypt's first democratically-elected president Mohammed Morsi was asked to speak.
But Morsi collapsed, falling unconscious and died shortly afterwards on his way to hospital.
His death comes six years after he was overthrown by the military after his one-year rule.
The incident has prompted reactions and messages of condolence all across the globe, with world leaders expressing their shock for his sudden death.
President Recep Tayyip Erdoğan was one of the first to react, offering his condolences to Morsi's family and the people of Egypt.
Speaking to the reporters in Istanbul, Erdoğan said current Egyptian leader Abdel Fattah el-Sissi overthrew freely-elected Morsi, executing 50 other Egyptians and putting democracy aside.
"Unfortunately, the incident took place in the court room. I first of all I wish God's mercy for our martyred brother Morsi," Erdoğan said.
"The West has always been silent in the face of these executions by Sissi. EU member states forbidding execution unfortunately accepted an invitation by this murderer Sissi to attend a meeting in Egypt," Erdoğan said, branding the EU as "hypocrites".
Mustafa Şentop, chairman of the Grand National Assembly of Turkey, also expressed condolences to "the people of Egypt, the Islamic world and oppressed nations all over the world."
Stating that he had received the news of his death with deep sorrow, Şentop said on Twitter that he believed the life and struggle of Morsi would guide those who follow in his footsteps.
"What happened in Egypt and to Muhammad Morsi, who struggled for the freedom and welfare of his people, is exemplary for it reveals the true nature and functioning of coup plotters targeting legitimate governments, and unveiling the true face of some of the Western apostles," he said.
Declaring Mursi and his friends as winners on the scales of justice and before history, Şentop said the coupists were the real losers and praised Morsi for being a great leader who had the courage to stand on the side of legitimacy.
Foreign Minister Mevlüt Çavuşoğlu also offered condolences after the demise of Morsi.
"The coup took him away from power, but his memory will not be erased from our hearts. The Ummah will not forget his firm stance! Rest in peace Morsi," he wrote on Twitter.
The ruling Justice and Development Party (AK Party)'s acting chairman Numan Kurtulmuş also called Morsi a "martyr" who had been elected by the legitimate votes of Egyptian people. He also extended condolences over Morsi's death.
"Egypt's first elected President Mohammed Morsi, was being tried in courtrooms under the control of the junta after an immoral and unlawful coup. He was martyred in the courtroom," AK Party spokesman Ömer Çelik said, joining other Turkish officials.
"Those who raised their voices to the coup and searched for ways of appealing fulfilled and are trying to fulfill their duty. But the so-called democratic world could not pass this test. They were silent against the executions and laid the red carpet to the putschists. This shame will always be written on their forehead," he said.
Qatar's ruler Sheikh Tamim bin Hamad Al-Thani expressed his "deep sorrow" following the "sudden death" of Morsi.
"We received with deep sorrow the news of the sudden death of former president Dr. Mohamed Morsi. I extend to his family and to the Egyptian people brotherly condolences," Al-Thani wrote on Twitter.
Meanwhile, Mohammed Sudan, a leading member of the Muslim Brotherhood in London, said Morsi's death was the equivalent of "premeditated murder" saying that the ousted leader, in jail since 2013, was banned from receiving medicine or visits and there was little information about his health condition.
Sudan added that Morsi during his trial "has been placed behind glass cage. 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 complained before that he doesn't get his medicine."
A leading rights group said Morsi's death was tragic but also "predictable" given Egyptian authorities' "failure" to allow medical care.
Sarah Leah Whitson, Middle East director with the Human Rights Watch, tweeted that Morsi's death was "terrible but entirely predictable" given the government "failure to allow him adequate medical care, much less family visits."
Morsi since his overthrow appeared only in court, almost always in a soundproof cage. His family said the 67-year-old Morsi suffered from ill health due to harsh conditions, including years of solitary confinement.
Please click to read our informative text prepared pursuant to the Law on the Protection of Personal Data No. 6698 and to get information about the cookies used on our website in accordance with the relevant legislation.
6698 sayılı Kişisel Verilerin Korunması Kanunu uyarınca hazırlanmış aydınlatma metnimizi okumak ve sitemizde ilgili mevzuata uygun olarak kullanılan çerezlerle ilgili bilgi almak için lütfen tıklayınız.