World leaders and tens of thousands of South Africans have paid tribute to the late Nelson Mandela at a national memorial service at the FNB stadium in Soweto.

US President Barack Obama hailed Mr Mandela as a "giant of history".

He said too many leaders in the world claimed solidarity with his struggle for freedom "but do not tolerate dissent from their own people".

In contrast to the warm reception Mr Obama received, South African President Jacob Zuma was booed and jeered as he prepared to speak at the memorial.

Ceremony organisers cut in with a choir to drown out the hostile reaction to Mr Zuma, who faces an election in six months.

Some of the crowd accompanied the boos for Mr Zuma with thumbs-down gestures and hand movements.

Opening the service this morning, ANC Deputy President Cyril Ramaphosa said Mr Mandela had done his job and could now rest, but added that the nation's work is only beginning.

He said: "We are here to tell Madiba that his long walk is over, that he can finally rest and enjoy the view of our beautiful country of South Africa. A view he discovered when he began walking the hills of his birthplace Mvezo.

"His long walk is over but ours is only beginning."

Mr Ramaphosa welcomed leaders from countries around the world and praised South Africans for the "dignified" way in which they had commemorated Mr Mandela's death.

UN Secretary General Ban Ki-moon described Mr Mandela as one of the world's greatest leaders, who taught by example.

He said: "South Africa has lost a hero, South Africa has lost a father. The world has lost a beloved friend and mentor.

"Nelson Mandela was more than one of the greatest leaders of our time, he was one of our greatest teachers. He taught by example - was willing to give up everything he had for freedom and equality, for democracy and justice."

Fondly known as Madiba, the former president and anti-apartheid campaigner died last Thursday, aged 95.

Ireland was represented at today's event by President Michael D Higgins, his wife Sabina and Tánaiste and Minister for Foreign Affairs Eamon Gilmore.

One of the Dunnes Stores strikers who took a stand against apartheid in 1984 was part of the official Irish delegation.

Others from that group also attended the event.

Former president Mary Robinson attended the service along with other members of 'The Elders' group of campaigning global leaders, which was founded by Mr Mandela.

Mr Mandela's friend and fellow former Robben Island inmate Andrew Mlangeni said the former leader would be proud of his fellow South Africans as they united to celebrate his life.

"Madiba is looking down on us now and there is no doubt smiling as he watches his beloved countrymen and women unite to celebrate his life and legacy," he said.

Obama hails inspirational leader

In his address to the crowd, Mr Obama said Mr Mandela moved billions of people around the world.

He said Mr Mandela resisted the title of "icon" and said he shared his doubts and fears along with his victories.

Mr Obama said: "It's tempting to remember Nelson Mandela as an icon, smiling and serene, detached from the tawdry of lesser men.

"But Madiba strongly resisted such a lifeless portrait, instead he insisted on sharing with us his doubts, fears, his miscalculations along with his victories.

"He was not a bust made of marble, he was a man of flesh and blood. He was a son, a husband, father and friend."

Mr Obama's comments came in front of an audience of leaders including Chinese Vice-President Li Yuanchao, Cuban President Raul Castro and Zimbabwean President Robert Mugabe.

Earlier, the US President shook the hand of Mr Castro, which was an unprecedented gesture between the leaders of the two nations that have been at loggerheads for more than half a century.

In his speech, President Obama described how Mr Mandela was an inspiration to him as a young man.

He said: "Although I will always fall short of Madiba’s example, he makes me want to be a better man."

He described the former president as a "magnificent soul", adding: "We will miss him deeply."

Meanwhile, Mr Obama and British Prime Minister David Cameron have come in for some criticism after they were caught posing for a mobile phone "selfie" at the memorial service.

Mr Mandela's body will lie in state for three days at South Africa's seat of government, the Union Buildings in Pretoria, until he is laid to rest in a state funeral at his home town of Qunu in the Eastern Cape on Sunday.

View images from the memorial.

Behind the scenes with the RTÉ team in South Africa.