Morsi's family attended funeral prayers in the mosque of Cairo's Tora prison, followed by the burial at a cemetery in the Egyptian capital's eastern district of Nasr City, said Abdul-Moneim Abdel-Maqsoud, a member of Morsi's defense team.
Morsi's son Ahmed said security agencies refused to allow Morsi to be buried at the family's cemetery in his hometown of Adwa in Sharqia province, and instead had him interred at a Cairo cemetery dedicated to prominent Islamists.
Dozens of people performed the absentee funeral prayer amid tight security in Adwa, according to residents and videos circulated online.
They took to the streets after the prayers to protest Morsi's death. Security forces dispersed them and no casualties reported, two residents said on conditions of anonymity for fear of reprisals.
Morsi, 67, 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 ouster the year before of longtime autocrat Hosni Mubarak.
The military toppled Morsi in 2013 after massive protests and crushed the Brotherhood in a major crackdown, arresting Morsi and many others of the group's leaders.
During his years in prison, Morsi, who was known to have diabetes, was often held in solitary confinement and was largely barred from receiving visitors. His family was only allowed to visit three times. While in detention, Morsi continued to appear in court on a range of charges.
In early court sessions he gave angry speeches until judges ordered him kept in a glass cage where they could turn off his audio.
Morsi's Brotherhood accused the government of "assassinating" him through years of poor prison conditions. The group demanded an international investigation into Morsi's death on Monday and called on Egyptians to protest outside Egyptian embassies across the world.
Late on Monday, Egypt's chief prosecutor said Morsi's body would be examined to determine the cause of his death. State TV, citing an unnamed medical source, said he died after suffering a heart attack.
Morsi collapsed just after he had addressed the court, speaking from inside the glass cage and warning that he had "many secrets" he could reveal, a judicial official said, speaking on condition of anonymity under regulations.
In his final comments, Morsi continued to insist he was Egypt's legitimate president, demanding a special tribunal, one of his defense lawyers, Kamel Mandour told The Associated Press. State TV said Morsi died before he could be taken to hospital.
There were a dozen other Brotherhood members on trial inside the glass cage, including some physicians who in vain tried to administer CPR, said Mandour.
It was a dramatic end for a figure central in the twists and turns taken by Egypt since its "revolution" - from the pro-democracy uprising that in 2011 ousted Mubarak, through controversial Islamist rule and now back to a tight grip under the domination of military men.
The Brotherhood won the elections held after Mubarak's fall, considered the first free votes the country had seen. First, they gained a majority in parliament, then Morsi squeaked to victory in presidential elections held in 2012, becoming the first civilian to hold the office.
Critics accused the Brotherhood of using violence against opponents and seeking to monopolize power and Islamize the state. Massive protests grew against their rule, until the military - led by then-Defense Minister Abdel-Fattah el-Sissi - ousted Morsi in July 2013, dissolved parliament and eventually banned the Brotherhood as a "terrorist group."
In August 2013, troops descended upon protest camps filled with Morsi's supporters, killing hundreds in Cairo's Rabaa al-Adawiya Square and elsewhere in a single day.
El-Sissi was elected president and re-elected in 2018, balloting that human rights groups sharply criticized as undemocratic. He has waged a ferocious crackdown that crushed the Brotherhood but also almost all other dissent, arresting tens of thousands, banning protests and silencing most criticism in the media.
Since his ouster, Morsi and other Brotherhood leaders have been put on multiple and lengthy trials. Morsi was sentenced to 20 years in prison on charges of ordering Brotherhood members to break up a protest against him, resulting in deaths. A death sentence against him was overturned and commuted to life imprisonment while multiple cases are still pending. Monday's session was part of a retrial on charges of espionage with the Palestinian Hamas militant group.
Hamas is part of the pan-Arab Brotherhood movement but has taken measures in recent years to reconcile with the current Egyptian authorities, removing from its founding charter parts that stressed explicit affiliation with the Brotherhood.
At Tuesday's funeral, security agents turned reporters away from the cemetery, banning them from taking photographs. Reporters were also barred from traveling to Morsi's hometown.
Abdel-Moneim Abdel-Maqsoud, another Morsi lawyer, said Morsi's imprisoned son, Ossama, was allowed to attend the burial. Ossama was sentenced to 10 years last September in a case related to the 2013 dispersal of a sit-in of Morsi's supporters.
The cemetery, which holds the remains of many top Brotherhood leaders, is also where the group's supreme guide Mahdi Akef was buried after his 2017 death in his prison at the age of 89.
Most Egyptian state-owned dailies only carried brief reports on Morsi's death, buried in inside pages of Tuesday editions, except Al-Masry Al-Youm, which had a front-page report.
Turkish President Recep Tayyip Erdogan said he doesn't believe Morsi died of natural causes, without providing evidence.
Erdogan made the comments at an Istanbul mosque, where hundreds held funeral prayers for Morsi, Egypt's first democratically elected president who was ousted by the military in 2013.
"Mohammed Morsi walked to join God during the trial. Whether this was a normal walk, or were there some other conditions involved, this is something to think about."
"I don't believe that this was a normal death," he said.
Rupert Colville, spokesman for the United Nations High Commissioner for Human Rights, called Tuesday for a "prompt, impartial, thorough and transparent investigation" into Morsi's death.
Also on Tuesday, Human Rights Watch criticized Egyptian authorities for failing to provide adequate medical care for Morsi.
The New York-based group's Sarah Leah Whitson said Morsi's treatment in prison was "horrific, and those responsible should be investigated and appropriately prosecuted."
"At the very least, the Egyptian government committed grave abuses against Morsi by denying him prisoners' rights that met minimum standards," she added.
Egypt's state information service later said Whitson's statements were "nothing but false claims" that reaffirm what it called HRW's tradition of "circulating lies."
This story has been corrected to show that the name of Morsi's lawyer is Mandour, not Madour.
Copyright 2019 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.