Nelson Mandela yesterday returned to his home where he will continue to receive intensive care after three months in hospital with a lung ailment.

The 95-year-old anti-apartheid leader and former South African president spent 87 days in a Pretoria hospital after he was taken there in early June.

He was suffering from a recurring infection of the lungs, a legacy of the nearly three decades he spent in jail under apartheid.

"Madiba's condition remains critical and is at times unstable. Nevertheless, his team of doctors are convinced that he will receive the same level of intensive care at his Houghton home that he received in Pretoria," South Africa's presidency said in a statement.

The statement referred to Mr Mandela by the traditional clan name by which he is affectionately known to South Africans.

The Nobel Peace Prize laureate's latest hospitalisation in June had attracted a wave of attention and sympathy at home and across the world.

His home in Johannesburg's Houghton suburb had been reconfigured to allow him to receive special care there, the presidency added. Police blocked off a section of the street in the up-market neighbourhood, where a crowd of reporters and television camera crews had gathered.

"The health-care personnel providing care at his home are the very same who provided care to him in hospital. If there are health conditions that warrant another admission to hospital in future, this will be done," the presidency added.

Mr Mandela's grandson and heir Mandla said in a statement: "It is a day of celebration for us, that he is finally back home with us," acknowledging that Mandela was "not a young man anymore".

Mandla Mandela said his grandfather's discharge disproved claims that Mr Mandela was in a vegetative state "waiting for his [life] support machines to be switched off, in effect declaring him dead".

Thousands of well-wishers visited the Pretoria medical facility during his stay there to leave flowers, cards and gifts.

Mr Mandela made his last public appearance waving to fans from the back of a golf cart before the Soccer World Cup final in Johannesburg in 2010.

In April the state broadcaster aired a clip of the thin and frail statesman being visited by President Jacob Zuma and top officials from the African National Congress.

The ruling party said he was in good shape but the footage showed a weak old man sitting expressionless in an armchair.

"He is out of hospital, that alone is good news for us. We don't want to be thinking negative. We just want to remain optimistic. He is alive and kicking and a part of us, that's good enough," Motemi Tinashe said outside the Mandela Family House Museum in Soweto, south of Johannesburg, where he lived before his imprisonment.

For more than a decade Mr Mandela has been out of politics, dividing his time between his home in Houghton and Qunu, the village in the impoverished Eastern Cape province where he was born.

His admission to hospital four times in six months has reminded the nation of the mortality of the father of the post-apartheid "Rainbow Nation" and of the morality he stood for.

"I often wonder how much Mr Mandela knows about what is going on in South Africa and the state of politics.

"The ANC is a disappointment and I pray he doesn't know that," said Thomas Mkhize, a Johannesburg taxi driver.