Nelson Mandela, South Africa's first black president and anti-apartheid icon, is recovering from a successful gallstone removal procedure, according to a government spokesman.

"The former president underwent a procedure via endoscopy to have gallstones removed. The procedure was successful and Madiba is recovering," President Jacob Zuma's office said in a statement on Saturday, using Mandela's clan name.

The 94-year-old Nobel Peace laureate was hospitalised in a Pretoria hospital with a lung infection last week after being flown from his home village of Qunu in a remote, rural part of the Eastern Cape province.

Tests revealed a recurrence of a lung infection and that he had developed gallstones, the government statement said.

Mandela spent time in a Johannesburg hospital in 2011 with a respiratory condition, and again in February this year because of abdominal pains. He was released the following day after a keyhole examination revealed there was nothing serious.

He has since spent most of his time in Qunu.

His fragile health prevents him from making any public appearances, although he has continued to receive high-profile domestic and international visitors, including former US President Bill Clinton in July.

Mandela was elected in historic all-race elections in 1994 after decades of struggle against apartheid. He spent 27 years in apartheid prisons, including 18 years on the Robben Island off the coast of Cape Town.

He stepped down in 1999 after one term in office and withdrawn from public life for the last decade.

Source: Agencies