JOHANNESBURG -- The possibility of a meeting between the two historic figures -- the first black president of the United States and the first black president of South Africa -- was so tantalizingly close. But with Nelson Mandela fighting for his life in a Pretoria hospital, President Obama abandoned his hope for a visit and instead on Saturday used every stop here to talk in emotional and sweeping terms about what Mr. Mandela meant to the world, and to him.
"I expressed my hope that Madiba draws peace and comfort from the time that he is spending with loved ones," Mr. Obama said after a meeting with some of Mr. Mandela's children and grandchildren, using the clan name by which Mr. Mandela is widely known. "I also reaffirmed the profound impact that his legacy has had in building a free South Africa, and in inspiring people around the world -- including me. That's a legacy that we must all honor in our own lives."
In an earlier news conference with South Africa's current president, Jacob Zuma, he also spoke about one of Mr. Mandela's greatest gifts: his ability to see beyond his own considerable legend.
"Despite how revered he was," Mr. Obama said, Mr. Mandela understood that government must be "bigger than just one person, even one of the greatest people in history. What an incredible lesson that is."
Mr. Obama had built his Africa trip months ago on the hope of meeting with Mr. Mandela, whom he has called a personal hero. And like many South Africans, he was eager to ensure that Mr. Mandela's legacy will live on through younger generations. He brought his two daughters on the trip, even as many locals spent Saturday taking their own children to makeshift memorials outside the Pretoria hospital where Mr. Mandela, 94, lay in critical condition and outside the Johannesburg home where he lived much of the time after his release from 27 years in apartheid prisons.
Herschelle Sigudla was one of those South Africans. He went to the hospital on a brilliantly sunny winter morning with his wife and two teenagers to pay their respects.
"We were in university during the struggle," said Mr. Sigudla, 43, a physiotherapist, referring to himself and his wife, Pinky, 39, a radiologist. "He inspired us to look forward to the new South Africa."
Mr. Sigudla and his family exuded the confidence and prosperity of the new South Africa's affluent, well-educated black middle class. With his arms around his children, he said: "We wanted to be here for our kids as well. This is history. One day they will learn it in school, and we want them to be able to say, 'We were there.' "
Mr. Obama not only praised Mr. Mandela at the news conference, but in his first visit here as president also hailed South Africa's historic integration from white racist rule as a shining beacon for the world.
"The struggle here against apartheid for freedom, Madiba's moral courage, this country's historic transition to a free and democratic nation has been a personal inspiration to me; it has been an inspiration to the world," he said.
The meeting with 10 of Mr. Mandela's family members replaced the meeting with Mr. Mandela himself, and was arranged according to the family's wishes, the White House said.
On Saturday afternoon, the presidential limousine slipped past a gate at the Nelson Mandela Centre of Memory, leaving reporters behind for the 25-minute meeting before Mr. Obama headed to a town-hall-style meeting with students in Soweto. In a statement after the family meeting, Mr. Obama said he had also spoken by phone with Graça Machel, Mr. Mandela's wife, who has been spending most of her time at her husband's bedside.
The Centre of Memory is expected to be the institution that keeps Mr. Mandela's legacy alive. The sleek glass-and-steel building lies just beside a roaring freeway in the upscale Houghton section of Johannesburg, not far from Mr. Mandela's home here.
A steady stream of mostly white well-wishers gathered outside that home Saturday, leaving flowers or inscriptions on small colored rocks clustered under trees outside the closed gates. One note, left under a tree, said: "Madiba, we drove across town without having to get permission. We live where we can, not where we are told to. All because of you and other heroes. Thank you, Lucien, Joelene, Ava and Luke."
At one point, Ms. Machel emerged from a vehicle leaving the grounds to greet the crowd in what was a rare public appearance since Mr. Mandela's latest bout of illness.
"I just wanted to say thank you," she said, accompanied by security guards, before getting back into her car and driving off. "All these messages you are compiling, it means so much to us. Every day he is getting well. So you should know that the message is getting across. Thank you so much."
Mr. Mandela was admitted to the hospital three weeks ago for a chronic lung infection. His condition turned critical, according to South African officials, just as Mr. Obama headed to Africa for a weeklong trip that started in Senegal.
The American president still plans to salute Mr. Mandela's life with a visit on Sunday to Robben Island, the prison where Mr. Mandela spent most of his incarceration. White House officials said Friday night that there was no change in the schedule, though Mr. Obama promised to "gauge the situation" based on Mr. Mandela's condition and his family's wishes.
Mr. Obama noted that he had visited Robben Island as a senator. He said he looked forward to taking his two daughters to Mr. Mandela's tiny prison cell to "teach them the history of that place and this country, and to help them understand not only how those lessons apply to their own lives," but also more broadly.
After traveling to Cape Town on Sunday, Mr. Obama will deliver a speech to university students that aides said would be built around themes that related to Mr. Mandela's legacy. Mr. Obama will end his trip in Tanzania on Monday and Tuesday.
Mr. Obama began his first full day in South Africa in a private meeting with Mr. Zuma, who noted that the talks had taken place "against the background of the ill health of our beloved former president." Mr. Zuma pointed to the symbolism of the moment, saying Mr. Obama and Mr. Mandela are "bound by history as the first black presidents" of their countries.
Afterward, Mr. Obama told reporters from both countries that his top priority for Africa was to help its governments to establish more stable and transparent democracies and to promote greater trade and investment that will help the economies of both the United States and the continent.
"I'm here in Africa because I think the United States needs to engage in a continent full of promise and possibility," Mr. Obama said, dismissing a question about whether America has fallen behind China and other countries in outreach to Africa. "I think it's good for the United States, whatever others do."
The meeting with students and others in the township of Soweto included video hookups to small groups in Kenya, Nigeria and Uganda -- three countries he is skipping on this trip. Students queried him on America's economic policies and terrorism in Africa, among other topics.
Many of the questioners, some of them young entrepreneurs, focused on how American investment and trade can help Africa's economies and businesses. Mr. Obama pledged to work toward better trade relations with African nations, saying if Africa is doing well, "we've got a market of people who will want to buy more iPads and Boeing airplanes and all the good stuff that we sell."
Outside Mr. Mandela's house, people were more focused on their more immediate future. "According to a lot of black people I spoke to through my staff, they all fear an eruption of violence," said Laurence Hodes, who lives in the same neighborhood. "But I don't think so. This is history."
Diana Anderson arrived with her two young children, one of whom peppered her with questions as they read cards stacked under a tree.
"Yes, he's still at the doctor's. He's not feeling well," Ms. Anderson told her 2-year-old, Rupert, who then asked, "Why?"
Ms. Anderson wiped away tears as she carried her children back to her vehicle. "It feels like he's dead already," she said. "Which is terrible."
Declan Walsh contributed reporting from Johannesburg, and Marcus Mabry from Pretoria, South Africa.
This article originally appeared in The New York Times.