Nelson Mandela has been discharged from hospital after treatment for pneumonia, South Africa's government has said.
It said there had been "a sustained and gradual improvement in his condition".
The 94-year-old was admitted on 27 March for a recurring lung infection and had fluid drained at the undisclosed hospital.
Mr Mandela served as South Africa's first black president from 1994 to 1999 and is regarded by many as the father of the nation.
The presidency statement read: "Former President Nelson Mandela has been discharged from hospital today, 6 April, following a sustained and gradual improvement in his general condition.
"The former president will now receive home-based high care. President [Jacob] Zuma thanks the hard working medical team and hospital staff for looking after Madiba so efficiently."
Madiba is Mr Mandela's clan name.
The statement continued: "[Mr Zuma] also extended his gratitude to all South Africans and friends of the Republic in Africa and around the world for support."