Egypt's first democratically elected president Mohamed Morsi was buried Tuesday, as the UN backed calls for an independent investigation into his death after he collapsed in a Cairo courtroom.
The Islamist, who was overthrown in 2013 after a year of divisive rule and later charged with espionage, was buried at a cemetery in eastern Cairo's Medinat Nasr, one of his lawyers said.
Abdel Moneim Abdel Maksoud said family members had washed Morsi's body and prayed the last rites early Tuesday at Leeman Tora Hospital.
That lies near the prison where Egypt's first civilian president, a prominent Muslim Brotherhood member, had been held for six years in solitary confinement and deteriorating health.
The prosecutor general's office said the 67-year-old had collapsed and "died as he attended a hearing" Monday over alleged collaboration with foreign powers and militant groups.
Abdel Maksoud said only around 10 family members and close Morsi confidants were at the funeral, including himself.
A handful of mourners were seen entering the cemetery, accompanied by police, but journalists were prevented from going in.
The graveyard is in the same suburb as the largest massacre in Egypt's modern history, the August 2013 crackdown on Islamist sit-ins at two Cairo squares, weeks after Morsi's ouster by the military.
Over 800 people were killed in a single day as security forces moved against protesters demanding Morsi's reinstatement.
The attorney general's office said Morsi, who appeared "animated", had addressed the court for five minutes before falling to the ground inside the defendants' glass cage.
Another Morsi lawyer, Osama El Helw, said other defendants had started banging on the glass, "screaming loudly that Morsi had died".
The attorney general said Morsi had been "transported immediately to the hospital", where medics pronounced him dead -- a version of events backed up by a judicial source.
'Killing Him Slowly'
Since Morsi's overthrow on July 3, 2013, his former defence minister, now President Abdel Fattah al-Sisi, has waged an ongoing crackdown that has seen thousands of Brotherhood supporters jailed and hundreds facing death sentences.
The UN called Tuesday for an independent probe into Morsi's death.
"Any sudden death in custody must be followed by a prompt, impartial, thorough and transparent investigation carried out by an independent body to clarify the cause of death," said Rupert Colville, spokesman for the UN High Commissioner for Human Rights.
He said Morsi "also appears to have been held in prolonged solitary confinement", and that the investigation must "encompass all aspects" of his treatment by the authorities.
The Brotherhood's political wing -- the Freedom and Justice Party -- accused Egyptian authorities of "deliberately killing him slowly".
"They withheld medication," it said. "They did not grant him the most basic human rights."
The government has not officially commented on his death.
Morsi's death was barely mentioned in local press, which referred to him by his full name but not his position as former president.
Morsi's family last saw him in September 2018. Abdel Maksoud was the last member of his defence team to see him, in November 2017.
Amnesty International also urged Egypt to open "an impartial, thorough and transparent investigation" into his death, while Human Rights Watch said Morsi had suffered years of "insufficient access to medical care".
A group of British parliamentarians in March 2018 warned his detention conditions, particularly inadequate treatment for his diabetes and liver disease, could trigger "premature death".
"Sadly, we have been proved right," Crispin Blunt, the MP who chaired the committee, said in a statement on Tuesday.
Allies such as Qatar and Turkey, widely seen as backing the Brotherhood, paid tribute to Morsi, as well as the Syrian opposition which he supported against President Bashar al-Assad.
In Turkey, thousands joined in prayers for him in Istanbul's Fatih mosque.
President Recep Tayyip Erdogan called Morsi a "martyr" and blamed Egypt's "tyrants" for his death.
Members of the Muslim Brotherhood in Jordan organised a condolence ceremony in honour of Morsi on Tuesday evening.
In a statement, it accused the "Egyptian regime of having assassinated" the ex-president by depriving him of medicine and contact with his family and friends.
But in his homeland, Morsi has a chequered legacy.
He spent a turbulent year in office before being toppled by the military following millions-strong protests demanding his resignation.
He had been in prison since his ouster, facing trial on charges including spying for Iran, Qatar and militant groups such as Hamas.
Morsi was sentenced to death in May 2015 for his role in jailbreaks during the uprising four years earlier that ousted longtime president Hosni Mubarak. He appealed and was being retried.
His death comes days before Egypt hosts the Africa Cup of Nations football tournament, starting Friday.
The Confederation of African Football said the security situation had not been affected by Morsi's death, and the tournament would go ahead as planned.