President Obama, at a memorial on Tuesday in South Africa, called the late Nelson Mandela "the last great liberator of the 20th century" who "earned his place in history through struggle and shrewdness" along with "persistence and faith."
He likened the late leader to Gandhi and Martin Luther King Jr. and said Mandela "speaks to what is best inside us."
"His struggle was your struggle," Obama said, speaking at First National Bank Stadium before an estimated crowd of tens of thousands of people, including British Prime Minister David Cameron, French President François Hollande, Oprah Winfrey and U2's Bono.
"His triumph was your triumph. Your dignity and hope found expression in his life, and your freedom, your democracy is his cherished legacy."
Obama compared Mandela to another of his heroes: Lincoln. He said when Mandela emerged from his time in prison "without force of arms, he would, like Abraham Lincoln, hold his country together when it threatened to break apart."
The president said "Madiba" showed the world "the power of action of taking risks on behalf of our ideals." And he quoted Mandela's own words saying, "I'm not a saint, unless you think of a saint as a sinner who keeps on trying."
South Africans affectionately call Mandela "Madiba," which is a term of endearment and has become a nickname. It is a family name and is derived from a chief who ruled in the 18th century, according to the Nelson Mandela Foundation.
"It was precisely because he could admit to imperfection — because he could be so full of good humor, even mischief, despite the heavy burdens he carried — that we loved him so," Obama said. "He was not a bust made of marble; he was a man of flesh and blood — a son and husband, a father and a friend.
"That is why we learned so much from him; that is why we can learn from him still," Obama continued. "For nothing he achieved was inevitable. In the arc of his life, we see a man who earned his place in history through struggle and shrewdness; persistence and faith. He tells us what’s possible not just in the pages of dusty history books, but in our own lives as well."
As Obama was walking to the podium to deliver his remarks on Tuesday, he shook hands with Cuban President Raul Castro, creating a side story of sorts at the memorial.
There has been tension between the two nations for about half a century.
Each time Obama quoted Mandela, the crowd in the soccer stadium cheered and pumped their fists in the air, especially when Obama quoting the late leader at his 1964 trial: “I have fought against white domination, and I have fought against black domination. ... I’ve cherished the ideal of a democratic and free society in which all persons live together in harmony and with equal opportunities. It is an ideal which I hope to live for and to achieve. But if needs be, it is an ideal for which I am prepared to die.”
Speaking to a half-empty stadium — where crowds took cover in the upper decks to avoid the pounding rain — Obama said that while Mandela's death is a time of mourning and a celebration of his "heroic life," it should also be a time for "self reflection."
"With honesty, regardless of our station or circumstance, we must ask: How well have I applied his lessons in my own life?" Obama said.
"It is a question I ask myself, as a man and as a president," Obama went on. "We know that, like South Africa, the United States had to overcome centuries of racial subjugation. As was true here, it took the sacrifice of countless people, known and unknown, to see the dawn of a new day. Michelle and I are the beneficiaries of that struggle."
But Obama said nations around the world could not not ignore the fact that, while progress is being made, "our work is not done."
"The struggles that follow the victory of formal equality and universal franchise may not be as filled with drama and moral clarity as those that came before, but they are no less important," he said.
It was the second time in one week that Obama paid tribute to the late South African leader. Shortly after his death was announced last Thursday, Obama, in brief remarks in the White House briefing room, called Mandela "one of the most influential, courageous and profoundly good human beings that any of us will ever share time with on this earth."
In his remarks in South Africa on Tuesday, Obama said Mandela's story "stirred something in me" and credited the late leader with inspiring his own trajectory and personal life.
"It woke me up to my responsibilities — to others, and to myself — and set me on an improbable journey that finds me here today," Obama said. "And while I will always fall short of Madiba’s example, he makes me want to be better.
Obama made the 16-hour trip to Johannesburg on Monday, accompanied by former President George W. Bush, former first lady Laura Bush and former Secretary of State and first lady Hillary Clinton. Former President Bill Clinton, who was attending a Clinton Global Initiative meeting in Rio de Janeiro, flew separately to South Africa.
On the flight to South Africa, shortly after departing, the Obamas, together with the Bushes, and Clinton — wearing a bracelet Mandela gave her — sat together in a conference room on Air Force One and reflected on Mandela's life, according to White House aides.
Obama had spoken with the South African leader many times on the phone. But he only met Mandela face-to-face one time, during a visit in 2006, when he was still a senator. First lady Michelle Obama visited with the leader five years later, without her husband, who wasn't on that particular trip to Africa.
In June, while traveling in Africa, Obama and the rest of the first family visited Robben Island, the jail where Mandela was imprisoned for 18 years.
The Obamas toured Mandela's jail cell, and Obama explained to his daughters about how political nonviolence took root in the country.
On the tour, Obama wrote in a guest book that he was "deeply humbled to stand where men of such courage faced down injustice and refused to yield."
The president had hoped to spend some time with Mandela during his visit to the country, but that visit was scrapped after the trip was planned due to Mandela's ailing health.
In his remarks on Tuesday, Obama said it "took a man like Madiba to free not just the prisoner, but the jailor as well."
He urged young people around the world to make "his life’s work your own."
"After this great liberator is laid to rest; when we have returned to our cities and villages, and rejoined our daily routines, let us search then for his strength — for his largeness of spirit — somewhere inside ourselves," he said.
— This report was updated at 7:34 a.m.