JOHANNESBURG (Reuters) - U.S. President Barack Obama shook hands with Cuba's Raul Castro at a memorial for Nelson Mandela on Tuesday, a rare gesture between the leaders of the ideologically opposed nations that reflected the anti-apartheid hero's spirit of reconciliation.
Castro smiled as Obama moved to shake his hand on the way to the podium before making a rousing speech in memory of the former South African president, one of the world's great peacemakers, who died on Thursday aged 95.
Torrential rain failed to dampen the spirits of tens of thousands of singing and dancing mourners at Johannesburg's Soccer City, who gathered to say farewell to Mandela alongside 90-odd world dignitaries.
The crowd emitted a huge roar as Obama took his seat, in marked contrast to the boos that greeted South African President Jacob Zuma, a scandal-plagued leader whose weaknesses have been cast into sharp relief by Mandela's death.
Zimbabwean leader Robert Mugabe also received wide applause from the raucous crowd in the half-filled 95,000-seat stadium.
Speaking yards away from communist leader Castro and Chinese Vice-President Li Yuanchao, Obama chided those who embraced Mandela's struggle against oppression yet suppressed opposition and critics in their own countries.
"There are too many of us who happily embrace Madiba's legacy of racial reconciliation, but passionately resist even modest reforms that would challenge chronic poverty and growing inequality," he said, referring to Mandela by his clan name.
"There are too many leaders who claim solidarity with Madiba's struggle for freedom but do not tolerate dissent from their own people," he said.
Relations between Cuba and the United States have been frozen since soon after Cuba's 1959 revolution led by Fidel Castro, who handed over to his brother Raul in 2008 because of ill-health. Washington has maintained economic sanctions against the communist-ruled island for more than half a century.
The only previous known handshake between U.S. and Cuban presidents since the revolution was in 2000 at the United Nations, when Fidel Castro shook the hand of then-U.S. President Bill Clinton in a chance encounter.
Coinciding with U.N. Human Rights Day, the memorial in the bowl-shaped soccer stadium - scene of the 2010 World Cup final - is the centerpiece of a week of mourning for Mandela, revered across the world as a symbol of reconciliation and forgiveness.
"He was more than one of the greatest leaders of our time. He was one of our greatest teachers," United Nations Secretary General Ban Ki-moon told the crowed. "His boabab tree has left deep roots that reach across the planet."
Since Mandela's death, Johannesburg has been blanketed in unseasonal cloud and rain - a sign, according to African culture, of an esteemed elder passing on and being welcomed into the afterlife by his ancestors.
The atmosphere inside the stadium before the ceremony was one of joy and celebration, more akin to the opening game of the World Cup three years ago that pitted jubilant hosts South Africa against Mexico.
Flag-waving whites and blacks danced, blew "vuvuzela" plastic trumpets and sang anthems from the long struggle against apartheid. The packed carriages of commuter trains heading to the ground swayed side-to-side with the rhythm.
"I was here in 1990 when Mandela was freed and I am here again to say goodbye," said Beauty Pule, 51. "I am sure Mandela was proud of the South Africa he helped create. It's not perfect but no-one is perfect, and we have made great strides."
Celebrities included singers Bono and Peter Gabriel, film star Charlize Theron, supermodel Naomi Campbell and Virgin entrepreneur Richard Branson. Francois Pienaar, captain of South Africa's victorious 1995 rugby World Cup-winning side, was also in the stands.
ZUMA UNDER PRESSURE
The crowd's reaction to Zuma is worrying for the African National Congress (ANC) which faces an election in six months amid concerns about persisting poverty, crime and unemployment nearly two decades after the end of white-minority rule.
The mourning has distracted attention from a slew of corruption scandals affecting Zuma and his administration.
But memories of Mandela's single five-year term have reminded many just how distant Zuma's South Africa remains from the "Rainbow Nation" ideal of shared prosperity and social peace that Mandela proclaimed after his 1994 election.
South Africa is still one of the most unequal societies on the planet. Despite two decades of affirmative action the average white household still earns six times more than the average black one.
After Tuesday's event, Mandela's remains will lie in state for three days at the Union Buildings in Pretoria, where he was sworn in as president in 1994.
He will be buried on Sunday, December 15 in Qunu, his ancestral home in the rolling, windswept hills of the Eastern Cape province, 700 km (450 miles) south of Johannesburg. Only a few world leaders are due to attend the Qunu ceremony, a more intimate family affair.
(Additional reporting by Steve Holland; Writing by Pascal Fletcher and Ed Cropley; Editing by Janet Lawrence)