Nelson Mandela has been able to return home after being discharged from a two-week spell in hospital for treatment for a lung infection and gallstones.

Former South African President Nelson Mandela smiles after casting his vote for elections at home in Houghton (Reuters)

The former South African leader is to receive treatment at his home in Johannesburg after he was discharged on Wednesday night, a government spokesman said.

South Africans began praying in earnest for Madiba, the clan name by which he is affectionately known, after he was admitted on December 8. The 94-year-old's time in hospital is the longest since he was released from jail in 1990 after 27 years behind bars.

He was taken into hospital for routine tests which revealed he was suffering from a lung infection and gallstones. He then underwent surgery to have the gallstones removed.

"He is not yet fully recovered, but he has sufficiently moved forward so that he can be discharged," Mac Maharaj, a government spokesman, told the local broadcaster, eNCA. "He is sufficiently well to be home."

Mandela has a history of lung problems dating back to the days during which he was in jail as a political prisoner.

He was visited on Christmas Day by South Africa's president, Jacob Zuma, who said he was in "good spirits" and looking "much better".

But this Christmas was his first away from home since he was released from jail.

The Nobel Peace Prize winner, and South Africa's first black president after the end of apartheid when he was elected in 1994, he retired from public life in 2004 due to his fragile health.

Before his retirement, he used to host a Christmas feast for poor children in his home village of Qunu.

Despite this, however, he has continued to receive high-profile domestic and international visitors, including former US president, Bill Clinton, in July.

More on this story