CAIRO — Egypt’s chief prosecutor has said former president Mohamed Morsi, who died Monday, “was immediately taken” to a hospital after fainting inside a glass cage in a Cairo courtroom where he was on trial.

But five Morsi supporters, including three of his attorneys who were inside the courtroom, said that at least 20 minutes, and perhaps as many as 40 minutes, elapsed between his collapse and his removal on a stretcher from the courthouse. Security agents did not allow his co-defendants, who included a few doctors, to immediately help the 67-year-old Morsi, according to witnesses.

“Dr. Morsi was kept like that for 20 to 30 minutes without help,” said Amr Darrag, a former minister in Morsi’s government who spoke with people in the courtroom and relatives of other defendants. “Somebody should have rushed to check on him. This gives more room for further doubts.”

The last moments of his life have raised anew questions about whether the Egyptian government had provided adequate medical care to Morsi, the country’s first democratically elected president, who was ousted by the military and then jailed. The United Nations, human rights groups and Morsi’s supporters have all called for an independent international investigation into his death. 

The Egyptian government has denied the allegations that Morsi received improper care under its watch and has rejected calls for an impartial probe, describing them as politically motivated.

Morsi, who was elected president in 2012 and toppled a year later, suffered from diabetes and liver and kidney ailments. In solitary confinement for six years, he had experienced diabetic comas because he was denied the proper insulin dosage and a special diet, according to Human Rights Watch. Monitoring of his blood pressure and sugar levels was only occasionally done, and he was forced to buy his own insulin.

Last year, a panel of British politicians and lawyers concluded that Morsi had received “inadequate medical care.” His detention conditions, they said, could meet the threshold for “torture.” Morsi had lost most of his sight in one eye because of medical negligence, his family said.

In the past three months, Morsi had faced a hectic schedule of court hearings, often held daily, certainly far more than usual, said Abdel-Moneim Abdel-Maqsoud, one of Morsi’s defense attorneys. Morsi was on trial for espionage and a host of other alleged crimes. 

On Monday, when Morsi stood up to address the court through a microphone inside his soundproof glass cage, “he sounded very exhausted,” Abdel-Maqsoud recalled. “But as he spoke, he became more normal.” 

 After five minutes of discussion about his plight, Morsi ended by quoting a line from a well-known Arabic poem that roughly translates to: “Even if my country victimizes me, it will still be dear to my heart. Even if my people victimize me, they will still be treated with dignity.” Then he sat down, Abdel-Maqsoud recalled. More than 50 other defendants were in a larger and separate glass cage next to Morsi’s.

 A few minutes later, chaos broke out inside the larger cage, also soundproof. Defendants were banging on the walls frantically. “They were signaling with their hands that Morsi had fainted and wanting the security people to let a doctor among them into his cage,” said ­Abdel-Maqsoud. “But the security refused.”

Bahaa Saad, the brother of one of Morsi’s co-defendants, was also in the courtroom and later wrote in a Facebook post that the defendants “felt helpless and unable to reach [Morsi] and check up on him. . . . Many between them were doctors who wanted to run to his rescue. But all they could do was bang hard on the walls.”

After ordering relatives of the defendants to leave the courtroom, the security guards brought in a doctor. By then, Morsi was motionless, said Abdel-Maqsoud, and some inside the cage were signaling that they thought he might be dead. When they took Morsi away on the stretcher, he looked like “someone who was sleeping,” Abdel-Maqsoud said.

By his estimate, it took roughly 40 minutes to take Morsi out of the courtroom. But Abdel-Maqsoud said he doesn’t blame the security guards, who were also following orders in not allowing anyone to enter ­Morsi’s cage and seeking a court-approved doctor. “Sadly, this is the system we live in,” he said.

But other Morsi supporters are less forgiving.

“No one treated him,” said Abdallah al-Haddad, whose father was one of the defendants in the cage. “No one did anything in the beginning, despite all the shouting and the banging. The guards were supposed to open the cage and make sure he was okay.”

After his arrest in 2013, Morsi had complained in court that he was not receiving adequate medical care in prison. He had limited access to his family and lawyers. In the past two years, though, Morsi had stopped appealing to the judge for better treatment.

“He stopped asking for medical care,” said Abdel-Maqsoud, who was allowed to see his client only four times in the six years he was detained. “I assume he had lost hope.”

By contrast, when Morsi’s autocratic predecessor, Hosni Mubarak, had health problems while in prison, he was transferred to a military hospital, remaining there in custody until his release in 2017. In court hearings, too, Mubarak was accorded privileges not given to Morsi. Mubarak was flown by helicopter and brought by ambulance to the courtroom, where he was wheeled in on a hospital gurney with a doctor present. Mubarak never had to enter the glass cage where Morsi and other defendants sat. 

On Monday, Morsi was pronounced dead at the hospital at 4:50 p.m., according to chief prosecutor Nabil Ahmad Sadiq. A preliminary medical report found no blood pressure, pulse or breathing and said that his pupils were dilated and not responsive. 

Egyptian authorities suggested in local media that Morsi had died of a possible heart attack. But Morsi did not have a history of heart problems, said Darrag, his former minister. No autopsy was conducted, he added, to confidently determine the cause of death.

Instead, Morsi was swiftly buried in a Cairo cemetery under heavy security with only his family members allowed to be present.

“At the end of the day, I know the intention of the regime was to kill Morsi,” Darrag said. “The way he was treated for the past six years was actually a slow-motion killing process.”