Cuban President Fidel Castro has told how he "thought it was the end" when he fell gravely ill in July 2006.
Fidel Castro said Brazil's Lula (left) was impressed with his recovery
The veteran 81-year-old leader wrote in an essay how he had been instructing officials what to do after his death as doctors battled to save his life.
But Mr Castro said Brazilian President Luiz Inacio Lula da Silva was impressed by the improvement in his health when he visited Cuba a week ago.
The Cuban leader said he had dedicated himself to "thinking and to writing".
"When I became seriously ill on the night of the 26 into the morning of the 27 July I thought it was the end," wrote Mr Castro in the essay dated Tuesday.
"While the doctors were fighting to save my life the head of the office of the Council of State [the island's supreme governing body] was reading the text of a proclamation and I was dictating the things that needed to be done."
Mr Castro has not been seen in public for almost a year-and-a-half, since the time he ceded power to brother Raul as acting leader.
Though the ailing leader no longer runs Cuba's government, he retains his role as head of the Council of State and voted by absentee ballot in elections earlier this month.
Cuba's parliament will meet on 24 February to elect the next president and a new Council of State.
Only then will it become apparent whether Fidel Castro wants to remain as head of state or retire and continue in his current role of elder statesman.