Venezuela's Hugo Chavez slid into a coma the day before he died of respiratory failure after cancer spread into his lungs, sources say.
Chavez's precise condition was one of the world's best-kept secrets since his cancer was announced in June 2011.
Since his death this week, however, details have emerged of the 58-year-old president's battle with cancer and the last moments in the hospital with close family and senior aides.
"They used iPads and other tools to give him policy presentations," one government source told Reuters, referring to ministers' visits to the Havana and Caracas hospitals where he spent his final weeks, unable to speak and breathing through a tube.
When appointing a new foreign minister, aides showed Chavez a list of several possible names, and he put a tick mark beside one - Elias Jaua - before signing the document, the source said.
After announcing in 2011 that cancer had been detected in his pelvic area, and a "baseball-sized" tumor removed, Chavez insisted on extreme privacy over the details of his health.
That was one of the reasons he chose to be treated in Cuba, where his friendship with past and present leaders Fidel and Raul Castro and the ruling Communist Party's firm grip on information guaranteed him discretion.
Chavez spent several months there on various visits, and underwent four operations, the last of which on December 11 was the most complicated.
His last words to aides before flying to Havana for that operation were: "I'll be back for sure."
METASTASIS IN LUNGS
Chavez did, indeed, fly home, but in such a bad state he could not be seen in public. He died of respiratory failure on Tuesday afternoon after the cancer had metastasized into his lungs, two sources said.
During two initial operations in mid-2011, Chavez had a tumor removed from his intestines, and was diagnosed with sarcoma in the psoas muscle that runs from the lower part of the vertebral column to the pelvis, a medical source said.
Though chemotherapy and radiotherapy kept the disease at bay and allowed him to run for re-election in October 2012, Chavez took heavy doses of medicines to enable him to make some heavily-staged campaign appearances - in a lot of pain.
On the last day of campaigning, standing for hours under a heavy rainfall, Chavez could bear it no longer, and a final rally was canceled. After the October 7 win, by an impressive 11 percentage points, an exhausted and suffering Chavez made few more public appearances before returning to Cuba weeks later.
The December 11 operation lasted six hours and left Chavez in a dire state, with hemorrhaging and a severe lung infection. He lost his pulse several times during the surgery and had to be resuscitated by doctors.
Cuban medics designed a special antibiotic to counter the infection, the medical source said, but even so Chavez had to undergo a tracheotomy to enable him to breathe through a tube in the windpipe.
In his last few days, a heavily-dosed Chavez met only with his closest family and aides despite a clamor from Venezuelan supporters - and opponents - to see him.
Even one of his closest friends and allies, Bolivia's leftist leader Evo Morales, was not allowed in to see him on visits to Caracas and Havana.
On Saturday, ministers were with him for about five hours, before a rapid deterioration began. He slipped into a coma on Monday and died at 4:25 p.m. local time (2055 GMT) on Tuesday.