Egypt's ousted president Mohammed Morsi dies in court
The 67-year-old was attending a session in his trial on espionage charges when he blacked out and then died. His body was taken to a hospital, it said.
He just addressed the court, warning from the dock that he had "many secrets" he could reveal.
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.
Morsi's son, Ahmed, confirmed the death of his father in a Facebook post.
Mohammed Sudan, leading member of the Muslim Brotherhood in London, described Morsi's death as "premediated murder" saying that the former president was banned from receiving medicine or visits and there was little information about his health condition.
It had previously been reported that he was suffering from fainting fits in prison and had twice fallen into comas.
Mr Sudan added: "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 complained before that he doesn't get his medicine. This is premediated murder. This is slow death."
Mr Morsi hailed from Egypt's largest Islamist group, the now outlawed Muslim Brotherhood, and was elected president in 2012 in the country's first free elections following the toppling of longtime leader Hosni Mubarak.
The military ousted the leader in 2013 after massive protests and crushed the Brotherhood in a major crackdown, arresting Mr Morsi and many others of the group's leaders.
He was handed a death sentence which was overturned in November 2016 but had remained behind bars.
The fifth President of Egypt served from June 30 2012 to July 3 2013, when he wa removed from power by General Abdel Fattah el-Sisi.
Mr Morsi was first elected to parliament in 2000 as an independent candidate, as the Brotherhood was barred from having candidates.