Spectators shelter under umbrellas as the rain lashes down during the memorial service for former South African President Nelson Mandela at the FNB Stadium in Soweto, near Johannesburg, South Africa, on Tuesday.

SOWETO, South Africa — In an outpouring of praise, remembrance and celebration, scores of leaders from around the world, including President Barack Obama, joined tens of thousands of South Africans in a vast rain-swept soccer stadium here Tuesday to pay common tribute to Nelson Mandela, whose struggle against apartheid inspired his own country and many far beyond its borders.

Huge cheers greeted Obama as he rose to offer a eulogy that blended a deep personal message with a broader appeal for Mandela’s values to survive him. It was a day for South Africans, swathed in their national colors, some wearing wraparounds bearing Mandela’s portrait, to celebrate their former president both as an inspiration for a long struggle and as an inherited memory for younger people raised in the post-apartheid era.

“To the people of South Africa — people of every race and every walk of life — the world thanks you for sharing Nelson Mandela with us,” Obama said. “His struggle was your struggle. His triumph was your triumph. Your dignity and hope found expression in his life, and your freedom, your democracy is his cherished legacy.”

Sheets of driving rain swept across this former segregated township — a huge urban sprawl within sight of the glittery rises of downtown Johannesburg — keeping some mourners away from the 95,000-capacity FNB Stadium where Mandela made his last public appearance during the soccer World Cup in 2010. The stadium was far from full as the start of the memorial approached.

“Even heaven is crying,” one woman in the crowd declared as the deluge continued. “We have lost an angel.”

For those tens of thousands who entered the stadium, the memorial service, part of a 10-day period of national mourning since Mandela died last Thursday, was a moment that fused revolutionary memories of the fight against apartheid with appeals for the values of forgiveness and reconciliation. Songs of the struggle, as the anti-apartheid campaign is known, blended with hymns and prayer.

Some stomped their feet as young protesters did during the years of protest that led to Mandela’s release from prison in 1990 after 27 years of incarceration. As much as visiting dignitaries sought to underscore their association with Mandela, their presence here also reinforced South Africans’ pride in him. The strains of South Africa’s national anthem — “Nkosi Sikelel’ iAfrika,” or “God Bless Africa” — swelled over the stadium.

“It is hard to eulogize any man — to capture in words not just the facts and the dates that make a life, but the essential truth of a person — their private joys and sorrows; the quiet moments and unique qualities that illuminate someone’s soul,” Obama said. “How much harder to do so for a giant of history, who moved a nation toward justice, and in the process moved billions around the world.”

The moment was not immune to more recent political undercurrents in advance of elections next year. President Jacob Zuma was greeted with boos and whistles from a crowd that cheered President Robert Mugabe of Zimbabwe, former South African president Thabo Mbeki and, loudest of all, Obama.

Using Mandela’s clan name, Obama declared: “It took a man like Madiba to free not just the prisoner, but the jailer as well; to show that you must trust others so that they may trust you; to teach that reconciliation is not a matter of ignoring a cruel past, but a means of confronting it with inclusion, generosity and truth. He changed laws, but also hearts.”

Striking a deeply personal note, he went on: “Over 30 years ago, while still a student, I learned of Mandela and the struggles in this land. It stirred something in me. It woke me up to my responsibilities — to others, and to myself — and set me on an improbable journey that finds me here today. And while I will always fall short of Madiba’s example, he makes me want to be better. He speaks to what is best inside us.”

People arriving for the ceremony reached for umbrellas and raincoats amid the drenching rain.

Nothando Dube, 31, left her home in Soweto at 5 a.m., first walking through the cold and then riding the rest of the way in a cab. She was at the stadium by 6 a.m., singing old struggle songs until the memorial began more than five hours later.

“It feels different when you sing it now as a free young person,” said Dube, wearing a beret of Mandela’s party, the African National Congress. “You try to reach that feeling, that emotion they were feeling when they sang that song in prison.”

U.N. Secretary-General Ban Ki-moon emphasized Mandela’s focus on forgiveness, a centerpiece of his presidency that helped South Africa move from apartheid to a multiracial democracy with considerably less upheaval than many had feared.

“He showed the awesome power of forgiveness — and of connecting people with each other and with the true meaning of peace,” Ban said. “That was his unique gift — and that was the lesson he shared with all humankind. He has done it again. Look around this stadium and this stage. We see leaders representing many points of view, and people from all walks of life. All here, all united.”

When it came to his turn to speak, Zuma struggled against a barrage of hoots and whistles as he approached the lectern. As the abuse continued, Zuma’s face on the huge screens was soon replaced with images of Mandela as music blasted through the speakers.

Zuma began his remarks as the restive crowd quieted, but many began leaving the stadium, streaming down concrete ramps and into the relentless rain.

“There is no one like Madiba,” Zuma said. “He was one of a kind.”

But, driving home a political message before the 2014 elections, Zuma emphasized that Mandela’s party, the African National Congress, was not about any one leader.

“Mandela believed in collective leadership,” Zuma said. “He never wanted to be viewed as a messiah or a saint. He recognized that all of his achievements were a result of working with the ANC collective.”

Tuesday’s ceremony drew an enormous array of global VIP’s, including at least 91 heads of state and government. The period of official mourning is scheduled to continue this week, with Mandela’s body lying in state for three days in Pretoria, and a state funeral Sunday in his remote boyhood village of Qunu in the Eastern Cape region.

The phalanx of dignitaries Tuesday included notables from Europe to Latin America and China.

In a gesture sure to be dissected for its symbolic and political significance, Obama shook hands with President Raúl Castro of Cuba, the brother of the longtime U.S. adversary Fidel Castro. Relations between the two countries have been less frosty of late but the Castro brothers remain divisive figures for many Americans, especially Cuban-Americans in Florida.

Some focused on the less celebrated mourners instead.

“This is a day for the people, not the powerful,” said Jay Naidoo, a close confidant of Mandela and one of his early government ministers. “What Nelson Mandela stood for most of all was solidarity with the downtrodden of the world, and for them he is a symbol of social justice and human rights. That is why I am saying my goodbye from the ranks of the people.”

The U.S. delegation included three former presidents — Bill Clinton, George W. Bush and Jimmy Carter — as well as former secretary of state Hillary Rodham Clinton, Michelle Obama and Laura Bush.

Britain and France were both represented by current and former leaders. “It was more a celebration than a commemoration,” Prime Minister David Cameron of Britain told reporters after the event.

Cyril Ramaphosa, a former labor leader who became a wealthy entrepreneur and, more recently, deputy leader of the governing African National Congress, presided over the ceremony, just as he played a central role when Mandela was released from prison in 1990.

“His long walk is over,” Ramaphosa declared, referring to “Long Walk to Freedom,” the title of Mandela’s autobiography. “But ours is only beginning.”