But the peace and harmony did not stretch to South African President Jacob Zuma, whom the crowd at the rain-soaked Soccer City stadium in Johannesburg booed and jeered as he prepared to give his closing address.

Mandela's death at the age of 95 has diverted attention from a slew of corruption scandals in Zuma's administration, while underscoring the gulf between South Africa's first black president, a giant of the 20th century, and its fourth.

"Mandela had a vision. Mandela lived that vision," said Funeka Gingcara-Sithole, 31, who was in the crowd. "But what Zuma speaks, he doesn't live. He should do the honourable thing and resign."

Zuma's reception was a marked contrast to the rock-star welcome for Obama, one of about 90 world leaders bidding farewell to Mandela in Johannesburg.

As he bounded onto the podium, Obama extended his hand to communist leader Castro, who shook it and smiled back.

The White House played down the move, saying it was a routine pleasantry, not a sign of a policy change.

"Nothing was planned in terms of the president's role other than his remarks," Deputy National Security Adviser Ben Rhodes told reporters. "He really didn't do more than exchange greetings with those leaders on his way to speak, it wasn't a substantive discussion," he added.

The only previous known handshake between US and Cuban Presidents since the island's 1959 revolution was at the United Nations in 2000, when Raul's brother Fidel shook the hand of then-US president Bill Clinton in a chance encounter.

Tough words

Obama's gesture did not prevent him delivering tough words to leaders who, he said, invoked Mandela's struggle against oppression while quashing opposition and dissent at home.

"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, speaking yards away from Castro and Chinese Vice-President Li Yuanchao.

"There are too many leaders who claim solidarity with Madiba's struggle for freedom but do not tolerate dissent from their own people," he added, using Mandela's clan name.

In Cuba, state-run television broadcast the Obama-Castro handshake without commentary, along with Castro's speech.

Some Cubans said they hoped the gesture could help to foster better ties. "I never imagined such a thing could happen," said Yesniel Soto, 25, on her way to a government job in Havana. "I see it as something that has begun to change, a change we are all hoping for,” she said.

Such hopes have been fuelled by several recent instances when cooperation has replaced hostile rhetoric.

Obama questioned last month in Miami whether an embargo put in place in the 1960s remained an effective way of tackling the United States' differences with Cuba.

But Rhodes noted that, while Washington has eased bans on family travel and remittances to Cuba, and taken other steps to allow greater contacts, points of friction remain.

"We continue to have the same grave concerns about both the human rights situation in Cuba and Alan Gross," he said.

Gross is a US government contractor jailed in Cuba for committing what a judge called a crime against the state.

Trouble for Zuma and ANC

Meanwhile, the crowd's reaction to Zuma, many gave the thumbs-down sign or rolled their wrists in a soccer substitution gesture, is a worrying sign for his African National Congress (ANC) as it heads for polls in six months.

Although Africa's biggest economy has been transformed since the end of white-minority rule in 1994, it remains one of the world's most unequal societies, plagued by poverty, crime and unemployment.

Even though its support is waning, the 101-year-old ANC is almost certain to keep power in 2014. Party spokesman Jackson Mthembu dismissed the jeers as a "little blot" on an otherwise successful event.

"It came as a bolt to all of us. We were quite surprised," he said. "The ANC thinks that this would not have been the best platform to convey such views," he added.

Coinciding with UN Human Rights Day, the memorial ceremony at the stadium, scene of the 2010 World Cup final, was the centerpiece of a week of mourning.

Mandela, revered across the world as a symbol of reconciliation and forgiveness, shared the 1993 Nobel Peace Prize with South Africa's last white president FW de Klerk.

"He was more than one of the greatest leaders of our time. He was one of our greatest teachers," UN Secretary General Ban Ki-moon told the crowd. "His baobab tree has left deep roots that reach across the planet."

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 in Qunu, his ancestral home in the rolling hills of the Eastern Cape province, 700 km (450 miles) south of Johannesburg. Only a few world leaders are due to attend what will be a more intimate family affair.


Latest News from World News Desk