JOHANNESBURG, South Africa - Former President Nelson Mandela underwent a successful surgery to remove gallstones Saturday, the nation's presidency said, as the 94-year-old antiapartheid icon is still recovering from a lung infection.

Doctors treating 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. Mandela has been hospitalized since Dec. 8.

In the procedure, a patient usually receives sedatives and an anesthetic to allow a surgeon to put an endoscope down his or her throat, authorities say. The surgeon then can remove the gallstones, which are small, crystal-like masses that can cause a person tremendous pain.

"The procedure was successful, and Madiba is recovering," Maharaj said, using Mandela's clan name as many do in South Africa as a sign of affection.

Occasionally, a patient who undergoes the same medical procedure Mandela just had may need to have an additional surgery to have the gallbladder removed, according to medical experts.

Mandela, South Africa's first democratically elected president, was admitted to a hospital in South Africa's capital, Pretoria, last Saturday, the government has said. At first, officials said Mandela was undergoing tests and later they acknowledged he had been diagnosed with a lung infection.

After the chaos that surrounded Mandela's stay at a public hospital in 2011, the South African military took charge of his care and the government took over control of information about his health. However, public worries over Mandela have grown as government officials contradicted themselves in recent days about Mandela's location, raising questions about who is actually treating him.

On Saturday, the South African National Editors' Forum issued a statement accusing the government of not being straightforward with journalists about Mandela's hospitalization. The forum said that journalists had been working with the government to set up guidelines on how to handle covering Mandela in his waning years, though state officials ultimately declined to sign off on the agreement.