(CNN) -- Former South African President Nelson Mandela was discharged from the hospital Saturday, the country's presidential office said, "following a sustained and gradual improvement in his general condition."
Mandela "will now receive home based high care," the statement said.
The 94-year-old, who was South Africa's first black president, was admitted to the hospital on March 27. He has received treatment for a recurring lung infection and pneumonia.
The governing African National Congress welcomed the news.
"Let us continue to keep President Mandela and his family in our prayers as he continues to receive treatment from home," the party said in a statement.
The presidential office did not specify whether Mandela would return to his home in Johannesburg or in his childhood village of Qunu.
Each home is equipped with a mini clinic that can provide 24-hour care as he continues his recovery from this bout of pneumonia.
Mandela, a Nobel Peace Prize winner, has become increasingly frail over the years and has not appeared in public since South Africa hosted the World Cup in 2010.
His history of lung problems dates back to when he was a political prisoner on Robben Island during apartheid. He contracted tuberculosis during the 27 years he was imprisoned.
He underwent treatment for a lung infection and had surgery to remove gallstones over the Christmas holiday in 2012, one of his longest hospital stays since his release from prison in 1990.
President Jacob Zuma "thanks the hard working medical team and hospital staff for looking after Madiba so efficiently," the statement from the presidential office said.
"He also extended his gratitude to all South Africans and friends of the Republic in Africa and around the world for support."
Madiba is Mandela's clan name, and how he is widely referred to in South Africa.
CNN's Per Nyberg and Robyn Curnow contributed to this report.