Nelson Mandela has left hospital and has gone to his Johannesburg home, where he is continuing to receive intensive care, the South African presidency says on its website.
The announcement came a day after officials denied reports that the 95-year-old had already been discharged.
The statement says Mr Mandela condition remains critical and at times unstable.
South Africa's first democratically elected president has been in hospital since June with a lung infection.
The Nobel Peace Prize laureate is revered around the world for leading the fight against white minority rule and preaching reconciliation with the white community despite being imprisoned for 27 years.
'Celebration'"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 [hospital]," the presidency statement says.
It says his home in the suburb of Houghton has been "reconfigured to allow him to receive intensive care there" and he will be treated by the same health care personnel who have been looking after him since 8 June.
If necessary, he will be readmitted to hospital, the statement says.
The BBC's Andrew Harding in South Africa says this is not the discharge of a man who has made a significant recovery but the transfer of a patient from an intensive care ward in a hospital to a specially built intensive care unit in his own home, presumably in line with his family's wishes.
But he notes that some people will take some encouragement from the fact that his doctors have said he was fit enough to make the 55km-journey (34 miles) and says such a decision will not have been taken lightly.
"It is a day of celebration for us, that he is finally back home with us," said his grandson Mandla Mandela.
On Saturday, sources close to Mr Mandela told the BBC and other international media that he had already returned home.
This was denied by South Africa's presidency, which handles all communications about the former leader's health.
Mr Mandela's lung condition is said to result from the tuberculosis he contracted during the 27 years he spent in prison for taking up arms against white minority rule.
He is been hospitalised four times in the past year and his latest stay lasted 84 days.
He became president after 1994 elections - the first time black South Africans were allowed to vote - and stepped down five years later.
His last public appearance was at the 2010 football World Cup, which South Africa hosted.