South Africa's first black president, Nelson Mandela, has had an operation to remove gallstones, according to a government statement.
The operation was successful and Mr Mandela is recovering.
Mr Mandela, who is 94, was admitted to hospital last Saturday after suffering a recurrence of a lung infection.
Tests revealed the presence of gallstones and doctors treating Mr Mandela decided to remove them once he had recovered from the infection.
The statement said: "This morning, 15 December 2012, the former president underwent a procedure via endoscopy to have the gall stones removed. The procedure was successful and (Mr Mandela) is recovering."
There is no indication at this stage when he might leave hospital in Pretoria.
A gallstone is an accumulation of crystals in the gall bladder. If left untreated, it can become life-threatening because of the risks of secondary infections such as pancreatitis.
Mr Mandela is regarded by most South Africans as the father of the nation, having inspired them to fight for democracy.
He led the struggle against white-minority rule before being elected the first black president in 1994.
Despite being imprisoned for 27 years by the apartheid government, he forgave his former enemies and urged South Africans of all races to work together and seek reconciliation.
He was awarded the Nobel Peace Prize in 1993.
Mr Mandela has been admitted to hospital on three occasions in the past two years.
In January 2011, he was treated for a serious chest infection in Johannesburg .
In February this year he was again admitted to a Johannesburg hospital because of abdominal pains. He was released the following day after tests revealed nothing serious.
Mr Mandela now lives in Qunu, a small rural village in Eastern Cape province, where he says he spent the happiest days of his childhood.
He retired from public life in 2004 and has been rarely seen in public since, though he still receives high-profile visitors.
Former US president Bill Clinton visited him in July.