Doctors treating Nelson Mandela said he was in a "permanent vegetative state" and advised his family to turn off his life support machine a week ago, court documents showed Thursday.
The June 26 court filing, obtained by AFP, shows for the first time just how close the still critically ill 94-year-old came to death.
"He is in a permanent vegetative state and is assisted in breathing by a life support machine," lawyers said on behalf of 15 family members including his wife and three daughters.
"The Mandela family have been advised by the medical practitioners that his life support machine should be switched off.
"Rather than prolonging his suffering, the Mandela family is exploring this option as a very real probability."
Family lawyer Wesley Hayes said the document was part of an effort to have a court urgently hear a dispute over the final resting place of three of Mandela's children, who were reburied amid a fierce family dispute Thursday.
Since the document was filed, the South African government, family members and Mandela's close friends have reported an improvement in his condition.
"He is clearly a very ill man, but he was conscious and he tried to move his mouth and eyes when I talked to him," Denis Goldberg, one of the men who was convicted with Mandela, told AFP after visiting him on Monday.
"He is definitely not unconscious," Goldberg said adding that "he was aware of who I was."
Presidency spokesman Mac Maharaj refused to comment on the documents, citing doctor-patient confidentiality.
"We have indicated from our point of view that based on the doctors' report the condition of the former president is critical but stable at this stage."
On the day the court document was written President Jacob Zuma reported that Mandela's health had faltered and he cancelled a trip to Mozambique.
The next day the president said his condition had "improved during the course of the night".
"It is not evidence but merely submissions on why a matter should be heard outside court sittings."
A spokesperson for Mandela's wife Graca Machel declined to comment.
Earlier in the day Machel said that while occasionally Mandela has been uncomfortable during his nearly one month hospital stay, he has seldom been in pain.
"Now we are about 25 days we have been in hospital," Machel said, giving thanks for the outpouring of well wishes from around the world for the Nobel peace laureate.
"Although Madiba sometimes may be uncomfortable, very few times he is in pain," she said.
The former president, who turns 95 later this month, was rushed to hospital on June 8 with a recurring lung infection.
Mandela's grandson thrust the increasingly acerbic family feud over the gravesites firmly into the public eye Thursday.
Mandla Mandela launched a tirade at close family members who took him to court to force him to return the remains of the three Mandela children to the revered South African leader's proposed burial ground in Qunu.
Mandla accused one of his brothers of impregnating his wife and others of being born out of wedlock.
He also accused other close relatives of money grabbing.
"In the past few days I have been the target of attacks from all sorts of individuals wanting a few minutes of fame and media attention at my expense," Mandla said at a nationally televised press conference.
He accused Mandela's daughter Makaziwe of trying to "sow divisions and destruction" in her family.
The anti-apartheid hero's ex-wife Winnie, who has regularly visited him in hospital, "has no business in the matters of the Mandelas," Mandla added.
He also lashed out at his own brother Ndaba for claiming he was born out of wedlock.
"I don't want to hang out our dirty linen as a family in public but he knows very well that my father impregnated a married woman of which he is the result of that act.... As for the remaining of my two brothers we all know that they are not my father's children."
Mandla however said he would not fight a court order to move the remains of his father, uncle and aunt from his estate in Mvezo -- the eastern village where he is overseeing large-scale development as the local traditional chief -- back to nearby Qunu, Mandela's childhood home.
The three bodies were exhumed Wednesday after a sheriff forced open the gates of Mandla's estate with a pickaxe to allow three hearses to enter the property.
The graves were moved in 2011, allegedly without the family's consent.
After forensic tests confirmed the identities, the hearses transported the remains to Qunu on Thursday for the reburial, according to police.