President Barack Obama waves as he arrives to speak to crowds attending the memorial service for former South African president Nelson Mandela at the FNB Stadium in Soweto near Johannesburg, Tuesday, Dec. 10, 2013. World leaders, celebrities, and citizens from all walks of life gathered on Tuesday to pay respects during a memorial service for the former South African president and anti-apartheid icon. President Barrack Obama acknowledges applause before speaking at the memorial service for former South African president Nelson Mandela at the FNB Stadium in Soweto near Johannesburg, Tuesday, Dec. 10, 2013. Winnie Madikizela-Mandela, Nelson Mandela's former wife, kisses Retired Anglican Archbishop Desmond Tutu during the memorial service for former South African president Nelson Mandela at the FNB Stadium in Soweto near Johannesburg, Tuesday, Dec. 10, 2013. Winnie Madikizela-Mandela, left, Nelson Mandela's former wife, attends the memorial service for former South African president Nelson Mandela at the FNB Stadium in Soweto near Johannesburg, Tuesday, Dec. 10, 2013. JOHANNESBURG (AP) - Amid cheers and song for the prisoner who became peacemaker, President Barack Obama energized tens of thousands of spectators and nearly 100 visiting heads of state Tuesday with a plea for the world to emulate Nelson Mandela, "the last great liberator of the 20th century." Obama's eulogy was the rhetorical highlight of a memorial service in which South Africans celebrated Mandela's life with singing and dancing, often during dignitaries' speeches. They also booed their own president and were chided by a top government official who said: "Let's not embarrass ourselves." Lashing rain lent a freewheeling aspect to the memorial, with people taking shelter in the stadium's wide hallways, where they sang anti-apartheid anthems from the 1970s and 1980s. Foul weather kept many away, and the 95,000-capacity stadium was only two-thirds full. Obama implored people to embrace Mandela's universal message of peace and justice, comparing the South African leader to Mahatma Gandhi, Martin Luther King Jr. and Abraham Lincoln. Mandela spent 27 years in prison under a racist regime, and promoted forgiveness and reconciliation when he was finally freed. But let me say to the young people of Africa, and young people around the world - you can make his life's work your own. He hailed Mandela, who died Thursday at 95, as the unlikely leader of a movement that gave "potent voice to the claims of the oppressed and the moral necessity of racial justice. " "Born during World War I, far from the corridors of power, a boy raised herding cattle and tutored by the elders of his Thembu tribe, Madiba would emerge as the last great liberator of the 20th century," Obama said, referring to Mandela by his clan name. Obama, who like Mandela became the first black president of his country, said he was inspired by Mandela as a student. The speech was greeted with thunderous applause, and many heads of state and other foreign dignitaries gave a standing ovation. Obama pointed out that "around the world today, men and women are still imprisoned for their political beliefs, and are still persecuted for what they look like, or how they worship, or who they love." Among the heads of state and government were some from countries like Cuba that don't hold fully democratic elections. On the way to the podium, Obama shook hands with Cuban President Raul Castro, underscoring a recent warming of relations between their countries. Other attending leaders criticized for their human rights records were Zimbabwe's Robert Mugabe, Equatorial Guinea's Teodoro Obiang Nguema and Gambia's Yahya Jammeh. Mandela's record after he was elected in the first all-race elections in 1994 has faced some criticism, most of it indirect because he is such a revered figure. He did not push for major restructuring of the economy, fearing it could alienate whites who still control most of South African industry. Today, the country struggles with economic inequality, though Mandela's moral stature sets him far apart from his successors. Mandela was a very humble man, and he gave himself to the world. It is a privilege to be here, it is a humbling experience," said 35-year-old Dipolelo Moshe, who works for a marketing company. She had a South African flag draped over her shoulders and carried a big photo of Mandela as she stood in line at the stadium. "His reconciliation allowed whites to be released themselves," Laird said. Thabo Mbeki, who succeeded Mandela as president, got a rousing cheer as he entered the stands. U.N. Secretary-General Ban Ki-moon waved and bowed to spectators as he called Mandela "one of our greatest teachers." He sacrificed so much ... for freedom and equality, for democracy and justice," Ban said. Mandela's widow, Graca Machel, and his former wife, Winnie Madikizela-Mandela, gave each other a long hug before the ceremonies began. Actress Charlize Theron, model Naomi Campbell and singer Bono were among the celebrities paying final tribute. Symbolically, Tuesday was 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. In his Nobel acceptance speech at the time, Mandela said: "We live with the hope that as she battles to remake herself, South Africa will be like a microcosm of the new world that is striving to be born." "Only great, great people are memorialized with it," said Harry Tshabalala, a driver for the justice ministry. People blew on vuvuzelas, the plastic horn that was widely used during the 2010 World Cup soccer tournament in South Africa, and sang songs from the era of the anti-apartheid struggle decades earlier. After Tuesday's memorial, Mandela's body will lie in state for three days at the Union Buildings in Pretoria, once the seat of white power, before burial Sunday in his rural childhood village of Qunu in Eastern Cape Province.