CAPE TOWN, South Africa — Challenging African youth to seize a “moment of great promise,” President Barack Obama declared Sunday that the future of the young and growing continent still rests in ailing South African leader Nelson Mandela’s vision for equality and opportunity. Seeking to carve out his own piece of that legacy, Obama unveiled an ambitious initiative to double electricity access in sub-Saharan Africa, vowing to bring “light where there is darkness.”

The president’s address at the University of Cape Town capped an emotionally charged day in this picturesque coastal city, including a solemn visit to the Robben Island prison where Mandela was confined for 18 of his 27 years in captivity. Obama stood stoically with his family in Mandela’s cramped cell and peered across the lime quarry where Mandela toiled each day, causing the damage to his lungs that led to his latest hospital stint.

“Nelson Mandela showed us that one man’s courage can move the world,” Obama said during his evening speech at the university. He was flanked by a diverse array of students, underscoring Mandela’s vision for a unified “rainbow nation” for the country once led by a white racist government.

In the flagship address of his weeklong trip to Africa, Obama outlined a U.S. policy toward the continent that focuses on increasing the region’s ability to support itself economically, politically and militarily. Harkening back to a prominent theme from his 2009 speech in Ghana — Obama’s only other trip to Africa as president — he said Africans must take much of the responsibility for achieving that goal, although he pledged American assistance.

“Ultimately I believe Africans should make up their own minds about what serves African interests,” he said. “We trust your judgment, the judgment of ordinary people. We believe that when you control your destiny, if you got a handle on your governments, then governments will promote freedom and opportunity, because that will serve you.”

Obama’s address came nearly 50 years after Robert F. Kennedy delivered his famous speech at the same university. Kennedy’s speech, delivered soon after Mandela was sentenced to life in prison, called on young people to launch a fight against injustice, creating ripples of hope that would “build a current which can sweep down the mightiest walls of oppression and resistance.”

Much has changed in South Africa since Kennedy addressed the nation. The apartheid regime crumbled under intense internal and external pressure. Mandela was elected as his country’s first black president following his release from prison. And South Africa has rapidly become continent’s economic and political powerhouse.

But Obama said that progress, in South Africa and elsewhere on the continent, rests on a “fragile foundation.” In order to solidify the gains, Obama called on Africans to focus on three priorities: expanding opportunity, promoting democracy and supporting peace.

A cornerstone of Obama’s efforts to expand opportunity is the new “Power Africa” initiative unveiled ahead of his speech. The venture is supported by $7 billion in U.S. investment and $9 billion from the private sector, and will seek to bring electricity to at least 20 million new households and commercial entities in an initial set of six countries: Ethiopia, Ghana, Kenya, Liberia, Nigeria and Tanzania.

The White House did not set a specific deadline for achieving that goal, but Obama advisers said it could happen within a decade. However, the first round of contributions still fall well short of the $300 billion the International Energy Agency says would be required to achieve universal electricity access in sub-Saharan Africa by 2030.

Obama opened his speech with deeply personal remarks about Mandela, tracing the anti-apartheid icon’s influence on his own political activism to his young daughters. He said that standing in Mandela’s cell alongside Malia and Sasha made the experience all the more poignant, reflecting on the distinction he shares with Mandela in being his country’s first black president.

“Seeing them stand within the walls that once surrounded Nelson Mandela, I knew this was an experience they would never forget,” he said. “I knew they now appreciated a little bit more that Madiba and other had made for freedom,” Obama added, referring to Mandela by his clan name.

Obama arrived in Cape Town Sunday from Johannesburg, where he met privately with members of Mandela’s family and spoke with the former president’s wife. In keeping with the family’s wishes, Obama did not visit Mandela in the hospital.

On a sunny winter day in the Southern Hemisphere, Obama and his family flew by helicopter to Robben Island, the prison that epitomized the struggle of Mandela and his contemporaries against apartheid rule. The Obamas were led through the island by Ahmed Kathrada, an 83-year-old former prisoner who was held alongside Mandela and had also given Obama a tour of the jail when he visited as a U.S. senator in 2006.

The Obamas solemnly peered across the bright white lime quarry where Mandela worked each day. They spent 20 minutes inside the tiny cell where Mandela spent nearly two decades of his life, all the while inspiring the anti-apartheid movement on mainland South Africa.

Before closing their visit, Obama and wife Michelle stoically entered a prison courtyard, the president’s hand on the small of the first lady’s back, to sign a guestbook.

“On behalf of our family we’re deeply humbled to stand where men of such courage faced down injustice and refused to yield,” Obama wrote. “The world is grateful for the heroes of Robben Island, who remind us that no shackles or cells can match the strength of the human spirit.”

The president also stopped Sunday at a health center overseen by Archbishop Desmond Tutu, a visit aimed at highlighting the impact of a U.S.-funded program to stop the spread of HIV and AIDS. The President’s Emergency Plan For AIDS Relief, or PEPFAR, was started by George W. Bush and continued by Obama.

Obama praised Tutu’s work in an emotional meeting in which Tutu said Africans are praying that Obama will be a success and a leader for peace, particularly in the Middle East. Many of their aides were brought to tears as the two men embraced in a hug.

The White House said the U.S. will spend about $4.2 billion on PEPFAR funding this year, money that has been used to increase the number of people receiving life-saving anti-retroviral drugs and to prevent mother-to-child transmission of the virus.

Bush, who has stayed active on Africa issues since leaving office, was scheduled to be in Tanzania today, the same day Obama arrives in the East African nation. The White House did not rule out the possibility of a meeting between the two presidents.