President Obama is returning home from a week-long trip through Africa, his first extended tour of the continent across three countries. The White House says the itinerary was designed to highlight African democracies and U.S. investment in health, business, and governance. Thoughts of former South African President Nelson Mandela, who is now gravely ill, were never far from mind.

NPR's Ari Shapiro was on the trip and has this round-up.

ARI SHAPIRO, BYLINE: During President Obama's first term, he spent less than one full day in sub-Saharan Africa. This trip was partly an effort to make up for lost time. The president traveled thousands of miles, from Senegal in the west, down to South Africa, and then to Tanzania in the east.

PRESIDENT BARACK OBAMA: There's an energy here that can't be denied. Africa rising.

SHAPIRO: This was from the trip's keynote speech at the University of Cape Town. The audience was mostly young, reflecting one major theme of this trip. Listen to South African President Jacob Zuma at a news conference with Obama.

JACOB ZUMA: A third of our population is under the age of 15.

SHAPIRO: And here's a woman from Uganda, who participated in a youth town hall.

UNIDENTIFIED WOMAN: More than half of our population is actually under the age of 15.

SHAPIRO: So when President Obama talked on this trip about Africa rising, he was making a demographic point as well as an economic one.

OBAMA: You've got time and numbers on your side. And you'll be making decisions long after politicians like me have left the scene.

SHAPIRO: Every time he spoke to this rising generation, he tried to impart the lesson of an icon from an earlier generation. The legacy of anti-apartheid hero Nelson Mandela suffused each moment of this trip.

OBAMA: Nelson Mandela showed us that one man's courage can move the world. And he calls on us to make choices that reflect not our fears but our hopes.

SHAPIRO: President Obama met with Mandela's relatives while their patriarch was in the hospital critical condition. The Obama family toured Robben Island, the prison site where Mandela spent 18 years.

The president did not just come here with warm sentiments, though. He came to do business - literally. In Tanzania, he met with U.S. and African CEOs, saying the era of foreign aid to Africa is ending and it's time to make Africa part of the global marketplace.

OBAMA: Of all our exports to the world, only about two percent goes to Africa. So I know we could be doing much more together.

SHAPIRO: One example of that is a new program called Power Africa. Only a third of people in sub-Saharan Africa have electricity. Obama wants American companies to change that by building power plants.

OBAMA: Ultimately, the goal here is for Africa to build Africa for Africans. And our job is to be a partner in that process.

SHAPIRO: Another initiative tries to make African farmers more productive by giving them access to technology. Jendayi Frazer handled African Affairs at the State Department under the Bush administration. She says these are good policies but they mostly repackage money that's already been appropriated.

JENDAYI FRAZER: And I understand budget constraint, but if this is a priority - and it's small amounts of money, quite frankly - I think that the president could do more to mobilize the resources; new money as well as, as he's positively doing, refocusing already appropriated money.

SHAPIRO: On the whole, the president got a warm reception on this trip. Tanzania renamed an oceanfront street Barack Obama Drive. In Senegal, people on Goree Island made up songs and chants with the Obama name.

(SOUNDBITE OF SINGING IN FOREIGN LANGUAGE)

SHAPIRO: But in South Africa, a few hundred people at the University of Johannesburg, Soweto, protested Obama's position on the Mid-East, drones and other foreign affairs.

(SOUNDBITE OF CHANTING PROTESTERS)

SHAPIRO: One place the President did not visit was his father's birthplace of Kenya. At a youth town hall, Kenyans participating remotely asked whether Obama would keep his promise to visit their country as President.