Nelson Mandela has undergone successful surgery to remove gallstones, according to the South African president's office.
The presidency said the 94-year-old Mr Mandela underwent the surgery earlier on Saturday. The presidency said Mr Mandela's doctors wanted to treat a recurrent lung infection before putting him through the surgery.
The statement said: "The procedure was successful and Madiba is recovering."
It referred to Mr Mandela by his clan name as a sign of affection.
Mr Mandela has been in hospital since December 8. He is revered for being a leader of the struggle against racist white rule in South Africa. He served one five-year term as president before retiring from public life.
Doctors treating Mr Mandela waited to perform the endoscopic surgery as they wanted to first attend to his lung ailment, presidential spokesman Mac Maharaj said in a statement.
"The procedure was successful and Madiba is recovering," Mr Maharaj said.
Mr Mandela largely retired from public life after serving one five-year term as president and has lived a mostly private life since. He last made a public appearance when his country hosted the 2010 World Cup soccer tournament. Mr Mandela has also grown more frail in recent years, with his grip on politics in the nation ever slackening.
He was admitted last week to a hospital in South Africa's capital, Pretoria, the government has said. However, government officials have contradicted themselves in recent days about Mr Mandela's location, raising questions about who is actually treating him.
With the government refusing to say where Mr Mandela is, concern has been growing and rumours continue to fly across this nation of 50 million people about Mr Mandela's health.