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 time unstable.
South Africa’s first democratically elected president has been in hospital since June with a lung infection.
“His team of doctors is 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 upmarket 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.
Johannesburg is about 55km (34 miles) south of South Africa’s capital, Pretoria.
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 became president after 1994 elections – the first time black South Africans were allowed to vote – and stepped down five years later.
The Nobel Peace Prize laureate has been widely acclaimed for preaching reconciliation with South Africa’s white community.
While he was in prison, there was a massive international campaign calling for Mr Mandela’s release.