Mohammed Morsi's death is a sombre milestone in Egypt's ill-fated democratic transition after the Arab Spring in 2011.
Egypt's first democratically elected president collapsed and died while on trial in a Cairo courtroom today, Egyptian state television reported.
Morsi, 67, won Egypt's first free presidential election in 2012 as a senior leader of the Muslim Brotherhood, but he was removed from power a year later in a military takeover.
He was on trial on espionage charges when he fainted and died, Egyptian television said.
Minutes before he collapsed, Morsi addressed the court from the glass cage that prisoners are kept in, warning that he could reveal "many secrets," AP reported, citing judicial sources.
The cause of death was not immediately released, but critics blamed Egyptian authorities for his death.
They said that Morsi's poor health was a long-standing issue and that there had been repeated and public warnings that lack of proper medical care in prison could lead to his death.
"His willful neglect is a case of premeditated murder," Mohammed Sudan, a prominent Brotherhood member, told Al Araby TV.
Morsi's election was the apex of the Arab Spring uprising and also of the Muslim Brotherhood, a 90-year-old Islamist movement founded in Egypt.
Inaugurated seven years ago this month, on June 30, 2012, Morsi became the first freely elected president in Arab history and the first Islamist to occupy that role.
Many Egyptians hoped the election of Morsi would make a definitive break with Egypt's long history of autocracy after decades of harsh and corrupt rule under President Hosni Mubarak. Mubarak was ousted in the 2011 uprising.
Critics in Washington and around the region raised alarms that Morsi might seek to impose strict moral codes or theocratic rule. But he surprised many by seeking cordial relations with the US, recognising the state of Israel and developing a warm working relationship with US President Barack Obama.
In foreign policy, Morsi worked with Obama to help negotiate a peace agreement to end a week of fighting between Israel and Palestinian militant group Hamas in 2012.
But Morsi's rule was troubled from the start. He governed clumsily, grappled with a hostile military establishment, and in 2013 faced a giant popular protest in Tahrir Square, the crucible of the 2011 uprising.
Egypt's top generals dissolved the country's first freely elected Parliament just days before Morsi's election and claimed most legislative and budgetary powers for themselves.
The protests in Tahrir Square provided the military with an excuse to oust him in 2013.
His defence minister, General Abdel-Fattah el-Sisi, seized power on July 3, 2013, and was later elected president. El-Sisi still rules Egypt with an iron grip, and the country's democratic hopes have been largely extinguished.
After Morsi was ousted in 2013, he was convicted of various crimes in politicised trials held under the new military-backed government. He has remained in prison since then.
Some members of Egypt's opposition blamed Egypt's prison conditions for Morsi's death.
"Morsi was a victim of brutal prison conditions," said Gamal Eid, a lawyer and human rights advocate, speaking by phone. "His family spent two years in court proceedings trying to win the right to visit him."
Last year, a panel of British politicians and lawyers reviewing his treatment concluded that Morsi received "inadequate medical care, particularly inadequate management of his diabetes and inadequate management of his liver disease."
The panel said the conditions fell below international standards and "would constitute cruel, inhuman and degrading treatment," Crispin Blunt, an MP who led the panel, said in a statement today.
"We feared that if Dr Morsi was not provided with urgent medical assistance, the damage to his health may be permanent and possibly terminal," Blunt said. "Sadly, we have been proved right."
The new government also outlawed the Muslim Brotherhood, calling it a terrorist group. The Brotherhood was founded in Egypt in 1928, and its ideas quickly spread to other Muslim-majority countries in the Arab world and beyond.
In April, US President Donald Trump pushed to designate the Brotherhood as a terrorist organisation under pressure from el-Sisi, a close ally.
The Pentagon and State Department objected, saying the group does not meet the definition of a terrorist entity.
Officials at those departments also said they feared that designating the Brotherhood as a terrorist group could complicate America's relations with a host of allied countries in the Middle East with influential Brotherhood-affiliated political parties.
Morsi's son Ahmed mourned his father on Facebook, writing: "Father, we will meet again, with God."
Morsi grew up in a family of modest means in the Delta city of Sharqiya, Egypt.
He earned a PhD in material science from the University of Southern California and later taught at Zagazig Univsersity, near Sharqiya.
Written by: Declan Walsh and David D. Kirkpatrick
© 2019 THE NEW YORK TIMES