World leaders who gathered to pay their respects to Nelson Mandela were challenged to carry on the anti-apartheid icon's mission of erasing injustice and inequality.

In a moving tribute that brought the crowd to its feet, U.S. President Barack Obama asked the mourners and the nearly 100 heads of state gathered at South Africa's FNB Stadium to live up to the ideals for which Mandela will be remembered.

"Around the world today, we still see children suffering from hunger and disease," Obama said. "Around the world today, men and women are still in prison for their political beliefs and are still persecuted for what they look like and how they worship and who they love.”

Calling Mandela the “last liberator” of the 20th century, Obama said: "There are too many people who happily embrace Madiba's legacy of racial reconciliation, but passionately resist even modest reforms that would challenge chronic poverty and growing inequality. There are too many leaders that claim solidarity with Madiba's struggle for freedom but do not tolerate dissent from their own people.

“And there too many of us on the sidelines, comfortable in complacency or cynicism, when our voices must be heard."

Those in the stadium gave roars of approval to Obama's speech.

Obama said it was upon learning of Mandela as a student 30 years ago that he was inspired to become politically engaged.

"It stirred something in me, it woke me up to my responsibilities to others and to myself, and it sent me on an improbable journey that finds me here today," he said. "And while I will always fall short of Madiba's example, he makes me want to be a better man. He speaks to what's best inside of us."

In stark contrast to the warm reception given to Obama, South African President Jacob Zuma was greeted with boos as he stood at the podium at Tuesday's memorial.

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.

Zuma said South Africans enjoy peace and democracy today because of the seed Mandela planted.

"Today Madiba is no more, but he leaves behind a nation that loves him dearly. He leaves behind a continent that's truly proud to call him an African.

"Most importantly he leaves behind a deeply entrenched legacy of freedom, human rights and democracy in our country.  In his honour we commit ourselves to continue building a nation based on the democratic values of humanity, dignity, equality and freedom." 

The torrential rains that greeted the spectators didn't appear to dampen the mood in the 95,000-seat stadium, as crowds sang and danced in the stands.

The memorial started at noon, about an hour behind schedule, with the venue being only half full. Those at the event suggested heavy traffic and the rain were behind the delay.

Following Obama's eulogy, a number of spectators, many who had sat in the rain for hours, left the stadium.

'South Africa has lost a hero'

Among the world leaders who spoke at the memorial was UN Secretary-General Ban Ki-moon, who described Mandela as one of the greatest leaders of our time.

"South Africa has lost a hero, they've lost a father. The world has lost a beloved friend and mentor," Ki-moon told the crowd.

"Nelson Mandela was more than one the greatest leaders of our time, he was also one of greatest teachers," Ki-moon said in his tribute to the anti-apartheid leader.

Despite the rain and the abundance of empty seats in the stadium, the mood inside the venue was celebratory, with a dazzling mix of royalty, statesmen and celebrities in attendance.

Close family friend Andrew Mlangeni, who spent nearly two decades in the neighbouring prison cell to Mandela on Robben Island, said the former South African president was an inspiration to millions.

"He embodied hope when there was none," he said. 

Nearly 100 heads of state attended the memorial – a testament to the impact the anti-apartheid leader had on the world.

Actress Charlize Theron, model Naomi Campbell and singer Bono were also in attendance.

Family member General Thanduxolo Mandela said in his tribute that that anti-apartheid icon lived his life to serve others.

"In his lifetime, Madiba mingled with kings, queens and presidents," he said. "But at the core of his being, he was a man of the people. A simple man."

He continued: "I am sure Madiba is smiling from above as he looks down on the multitude of diverse faces that are here. For this is what he's known for -- the equality of man, the brotherhood of humanity and the unity of progressive peoples, until his last days."

Along with Prime Minister Stephen Harper and his wife Laureen, the Canadian contingent that travelled to South Africa to honour Mandela included former prime ministers Brian Mulroney, Kim Campbell, Jean Chretien and Joe Clark. NDP Leader Tom Mulcair was also in attendance, as were four provincial premiers and former governers-general Michaelle Jean and Adrienne Clarkson.

Other speakers to deliver a eulogy at the memorial included Chinese Vice-President Li Yuanchao and Cuban President Raul Castro the presidents of Brazil, Namibia and India, as well as tributes from Mandela's grandchildren.

Tuesday marked 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.

Mandela died at his Johannesburg home on Dec. 5 at the age of 95. He will lie in state before his burial in his hometown of Qunu on Sunday.

With files from The Associated Press