By Kim Sengupta

The remembrance ceremony on Tuesday for Nelson Mandela became an occasion for international reconciliation, however briefly, with US President Barack Obama shaking hands with Cuban President Raúl Castro, the long enmity between the two countries set aside.

In this image from TV, US President Barack Obama shakes hands with Cuban President Raul Castro at the FNB Stadium in Soweto, South Africa, in the rain for a memorial service for former South African President Nelson Mandela, Tuesday Dec. 10, 2013. The handshake between the leaders of the two Cold War enemies came during a ceremony that's focused on Mandela's legacy of reconciliation. Hundreds of foreign dignitaries and world heads of states gather Tuesday with thousands of South African people to celebrate the life, and mark the death, of Nelson Mandela who has became a global symbol of reconciliation. (AP Photo/SABC Pool)

The remembrance ceremony on Tuesday for Nelson Mandela became an occasion for international reconciliation, however briefly, with US President Barack Obama shaking hands with Cuban President Raúl Castro, the long enmity between the two countries set aside.

With Mandela's message of reconciliation hanging over the ceremony, Castro smiled as Obama shook his hand on the way to the podium to make a rousing speech in memory of the former South African president, one of the world's greatest peacemakers, who died on Thursday aged 95.

Relations between Cuba and the United States have been frozen since soon after Cuba's 1959 revolution led by Raúl's brother Fidel Castro, and Washington has maintained economic sanctions on the communist-ruled island for more than half a century.

Tens of thousands of singing and dancing mourners braved hours of torrential rain at Johannesburg's Soccer City as 90-odd world dignitaries filed into the stadium.

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.

Mr Obama compared Mr Mandela to Mahatma Gandhi, Martin Luther King Jr and Abraham Lincoln, declaring that the legacy of the South African leader who defeated apartheid must not be wasted.

He chided leaders who were quick to claim solidarity with Mandela's struggle with oppression and injustice, but did not allow freedom 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.

"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.

Mr Obama also shook hands with Brazilian president Dilma Rousseff, who had been stridently critical of National Security Agency spying.