JOHANNESBURG — Nelson Mandela, South Africa’s former president, was discharged Friday from a Johannesburg hospital after a two-night stay that prompted widespread concern about the 92-year-old’s health.

Mandela responded well to treatment for an acute respiratory infection and will now receive care at home, the country’s surgeon general, Vejayn Ramlakan, told reporters Friday at the Netcare Milpark Hospital. Mandela is “well” and in “high spirits,” he said.

“There is no need to panic,” Ramlakan said. “For 92, he surprises us on a daily basis” with his response to treatment.

Mandela, South Africa’s first black president, hadn’t been seen in public since a brief appearance at the final of the soccer World Cup on July 11 in Johannesburg. The Nobel Peace Prize winner was president for five following South Africa’s first all-race elections in 1994.

“It comes to us with great joy to hear that he has been discharged,” Mandla Mandela, the former leader’s grandson, told the press conference.

Mandela suffered from tuberculosis on Robben Island prison, where he spent most of his 27-year jail term for fighting against the apartheid government, and has also had respiratory infections in the past. He was treated for prostate cancer in 2001.

Relatives, including Mandela’s former wife, Winnie Madikizela-Mandela, friends and leaders of the ruling African National Congress flocked to the hospital Thursday. Police boosted security there, cordoning off the entrance and restricting journalists and TV cameras from entering the premises.

Security was also increased around Mandela’s home in the Johannesburg suburb of Houghton, where he arrived by ambulance after leaving the hospital, according to the South African Press Association.

Mandela received 10,000 messages of support, including from President Obama.