Washington (CNN) -- In 1980, Nelson Mandela was sitting in a South African prison cell, serving a life sentence.
On the other side of the world, a young college student named Barack Obama was riveted by the anti-apartheid movement in South Africa and the brewing crusade to free the renowned activist.
Little did they know that nearly three decades later, the two would have something in common: They would be the first elected black presidents in their respective countries.
U.S. President Barack Obama has made it no secret that he considers Nelson Mandela one of the greatest influences -- if not the greatest -- in his life and in the lives of countless others. Throughout his first five years in office, he has repeatedly referenced Mandela, either invoking quotes from the anti-apartheid icon or spreading his messages of freedom and equality.
"We have lost one of the most influential, courageous, and profoundly good human beings that any of us will share time with on this earth," the President said Thursday while marking Mandela's death. "He no longer belongs to us -- he belongs to the ages."
Answering a 'call'
At Occidental College in Los Angeles around 1980, Obama first forayed into political activism — a protest against apartheid. It was the beginning of what would become years of studying Mandela's speeches and writings.
"In the most modest of ways, I was one of those people who tried to answer his call," he wrote in the forward to Mandela's 2010 memoir "Conversations with Myself."
Obama has acknowledged that none of the obstacles he faced growing up compared to those of the victims in South Africa, but Mandela's "example helped awaken (Obama) to the wider world," he wrote in the forward.
"Through his choices, Mandela made it clear that we did not have to accept the world as it is -- that we could do our part to seek the world as it should be," he added.
In his own book, "Dreams of my Father," Obama recalls giving his first public speech, in which he made a plea for the trustees at Occidental to divest from South Africa.
"I really wanted to stay up there, to hear my voice bouncing off the crowd and returning back to me in applause."
Following his involvement with the demonstrations, Obama began pursuing his interests in public policy, transferring to Columbia University where he dug deep into books and courses about race and social justice. After graduation, he became a community organizer in Chicago.
When Mandela was released from prison in 1990, Obama was well into law school at Harvard and getting ready to start the next phase of his career.
That same month, Obama made history of his own — though on a much smaller scale. He became the first African-American president of the Harvard Law Review, a story big enough to elicit a headline in the New York Times.
In his interview with the Times, Obama said, ''I personally am interested in pushing a strong minority perspective. I'm fairly opinionated about this," he said. "But as president of the law review, I have a limited role as only first among equals.''
Four years after graduating law school, and not long after Mandela won a Nobel Peace Prize and was elected president, Obama published "Dreams of my Father" in 1995. In the memoir, he lumped Mandela in with a group of men whose attributes Obama aspired to emulate.
"It was into my father's image, a black man, son of Africa, that I'd packed all the attributes I sought in myself, the attributes of Martin and Malcolm, DuBois and Mandela," he wrote.
A year later, Obama was elected to the Illinois state Senate, a path that would set him on a fast-moving track that landed him a spot on the presidential ballot just 12 years later.
'A personal hero'
As Obama made his way up the political ladder, Mandela was continuing to spread his influence, campaigning for justice and human rights around the world. He didn't seek reelection in 1999 -- keeping his promise to serve only one term -- and he became intimately involved with AIDS awareness, a disease that killed his son at the age of 55 in 2005.
Obama met Mandela for the first time in 2005. Obama, a senator at the time, was riding to a Washington event when his office called; Mandela was in town and asked to see him. The two men met at the Four Seasons Hotel.
After that, Obama and Mandela had occasional interactions and conversations, including a phone call from Mandela after Obama was elected president in 2008. Obama called Mandela in 2010 after his great-granddaughter was killed in a car crash.
While Obama considered Mandela a champion, he frequently noted he was not alone in his views about the icon.
"He's a personal hero, but I don't think I'm unique in that regard," he said in Senegal. "I think he's a hero for the world."
During his first year in the Oval Office, Obama was awarded the Nobel Peace Prize -- a decision that sparked controversy, considering that his career on the world stage was only at its infancy at that point.
Obama was keenly aware of where he stood in line.
"Compared to some of the giants of the history who've received this prize, Schweitzer and King, Marshall and Mandela, my accomplishments are slight," he said in his acceptance speech, also paying tribute to those who were suffering in their respective fights for freedom and justice around the world. "I cannot argue with those who find these men and women -- some known, some obscure to all but those they help -- to be far more deserving of this honor than I."
'That's what brings me back here'
On a trip to Africa this summer, Obama and his family visited Mandela's cell on Robben Island, a spot Obama visited as a senator in 2006. But this time, he got to bring his two daughters, Sasha and Malia.
"For me to be able to bring my daughters there and teach them the history of that place and this country ... that's a great privilege and a great honor," Obama told students at the University of Cape Town in June.
With Mandela gravely ill, Obama did not get to visit him during his trip; he met with Mandela's family instead. While in South Africa, Obama noted the "outpouring of love" for Mandela, saying it spoke to "the yearning for justice and dignity that transcends boundaries of race and class and faith and country."
"That's what Nelson Mandela represents," he said at a town hall-style meeting with young people in Soweto. "That's what South Africa, at its best, can represent to the world, and that's what brings me back here."
CNN's Gabriella Schwarz, Brianna Keilar and Faith Karimi contributed to this report