Police were expecting a crushing crowd at FNB stadium and had set up overflow points with big screen TVs, but the foul weather and public transportation problems kept many people away. The 95,000-capacity stadium was only two-thirds full.
Addressing the memorial service for Mandela, who died Thursday at age 95, Obama pointed out that "around the world today, men and women are still imprisoned for their political beliefs; and are still persecuted for what they look like, or how they worship, or who they love."
Among the nearly 100 heads of state and government were some from countries like Cuba that don't hold fully democratic elections. On the way to the podium, Obama shook hands with Cuban President Raul Castro, underscoring a recent warming of relations between Cuba and the U.S.
In contrast to the wild applause given to Obama, South African President Jacob Zuma was booed. Many South Africans are unhappy with Zuma because of state corruption scandals, though his ruling African National Congress, once led by Mandela, remains the front-runner ahead of elections next year.
Some of the dozens of trains reserved to ferry people to the stadium in Soweto, a township which revolted in 1976 against white rule, were delayed due to a power failure. A Metrorail services spokeswoman, Lilian Mofokeng, said more than 30,000 mourners were successfully transported by train.
The mood was celebratory. A dazzling mix of royalty, statesmen and celebrities was in attendance.
Thabo Mbeki, the former South African president who succeeded Mandela, got a rousing cheer as he entered the stands. French President Francois Hollande and his predecessor and rival, Nicolas Sarkozy, arrived together. United Nations Secretary-General Ban Ki-moon waved and bowed to spectators who sang praise for Mandela, seen by many South Africans as the father of the nation.
"I would not have the life I have today if it was not for him," said Matlhogonolo Mothoagae, a postgraduate marketing student who arrived hours before the stadium gates opened. "He was jailed so we could have our freedom."
Rohan Laird, the 54-year-old CEO of a health insurance company, said in the stadium that he grew up during white rule in a "privileged position" as a white South African and that Mandela helped whites work through a burden of guilt.
"His reconciliation allowed whites to be released themselves," Lair said. "I honestly don't think the world will see another leader like Nelson Mandela."
Workers were still welding at a VIP area as the first spectators arrived amid an enormous logistical challenge of organizing the memorial for Mandela, who died Dec. 5 in his Johannesburg home at the age of 95.
Mandela's widow, Graca Machel, and former wife Winnie Madikizela-Mandela were at the stadium, and gave each other a long hug before the ceremonies began. So were actress Charlize Theron, model Naomi Campbell and singer Bono.
Tuesday was the 20th anniversary of the day when Mandela and South Africa's last apartheid-era president, F.W. de Klerk, received the Nobel Peace Prize for their efforts to bring peace to their country. De Klerk, a political rival who became friends with Mandela, was also in the stadium.
Mandela said in his Nobel acceptance speech at the time: "We live with the hope that as she battles to remake herself, South Africa will be like a microcosm of the new world that is striving to be born."
The sounds of horns and cheering filled the stadium. The rain was seen as a blessing among many of South Africa's majority black population.