First came the signs, then the shirts, and a street.

“Welcome home, Mr. President,” posters in Senegal read. In South Africa, children wore clothing with his likeness. And in Tanzania, the government renamed the boulevard outside the presidential palace “Barack Obama Drive.”

During President Obama’s first extended trip to Africa, 4½ years after he entered the White House, there was a palpable sense that he remained a symbol of hope, despite any disagreements over his policies.

The candidate who inspired so many in 2008 has been battered during his time in office, winning some policy fights and losing others. Along the way, he jokes, he has become older and grayer, nicked and bruised by partisan political fights.

But during a six-day visit to three countries, many seemed proud that the first black American president had visited the continent, never mind that Obama had chosen not to visit Kenya, his father’s place of birth. Obama’s image was plastered on billboards, bus stops, concrete walls, lampposts and even on patterned cloth skirts worn by women welcoming him at a ceremony at the airport in Dar es Salaam.

“Mr. President, when you became the first black incumbent of the White House, you don’t know what you did for our psyches,” Archbishop Desmond Tutu told Obama when the president visited his community health center in Cape Town. At the center, the president toured a classroom, where children worked on computers and a young boy nicknamed Kat-meister performed an impromptu rap. (“Don’t forget to drop the mike,” Obama told him, delivering a fist bump.)

“My wife sat in front of the TV with tears running down her face as she watched the celebration with you in Chicago,” Tutu continued. “You won. And we won. And you repeated the feat when the odds were stacked against you. So welcome home, even if you’re about to go.”

Onlookers chuckled, but the older man, sitting next to Obama at a long, thin table, leaned in closer. “Your success is our success. Your failure, whether you like it or not, is our failure,” he said slowly. “And so we want to assure you that we pray for you to be a great success.”

Obama looked uncertain while Tutu talked — here was a man who, like the ailing, 94-year-old Nelson Mandela, had fought apartheid and inspired a younger Obama into political activism. Now, Tutu was handing him their mantle.

From promise to progress?

Obama’s Africa policy on trade, development and health care has been criticized for not being as robust as those of his two predecessors, George W. Bush and Bill Clinton. The trip was a chance to reset the agenda.

During a short visit to Ghana in 2009, Obama declared that it was a “moment of great promise” on the continent. But he brought a new message on this trip. During a speech at the University of Cape Town, he hailed a “moment of great progress” in Africa — one his administration, he said, was eager to take part in.

The president’s pledges, however, were modest. He announced a new program to bring 500 young African leaders to the United States each year for training on democratic values. He laid out plans to invest $7 billion in a “Power Africa” energy program to double access to electricity in the sub-Saharan region. And he juggled a soccer ball fitted with a tiny generator that, charged by the movement of the ball, would help power small lights and cellphones in rural communities.

Looking to the future

As he so often has in the United States and around the globe, Obama focused much of his attention on young people. The goal, administration officials explained, was to inspire the next generation on the values of democracy and freedom on a continent where 60 percent of the population is under 35.

Speaking at the University of Cape Town, Obama quoted from Robert F. Kennedy’s speech at the school in 1966: “Each time a man stands up for an ideal, or acts to improve the lot of others, or strikes out against injustice, he sends forth a tiny ripple of hope, and crossing each other from a million different centers of energy and daring, those ripples build a current which can sweep down the mightiest walls of oppression and resistance.”

It was a message Obama delivered time and again, a black president of the most powerful country on the planet, visiting historical sites where black Africans had long been oppressed.

Obama and his family toured Robben Island, where Mandela spent nearly two decades as a political prisoner before his release in 1990.

The president, first lady Michelle, her mother and their two daughters listened as their guide, an 83-year-old man who also had also been jailed there, explained the significance.

Obama, wearing sunglasses, a windbreaker and khaki slacks, looked at daughters Malia and Sasha and said: “One thing you guys might not be aware of is that the idea of political nonviolence first took root here in South Africa because Mahatma Gandhi was a lawyer here in South Africa. Here is where he did his first political activism. When he went back to India, the principles ultimately led to Indian independence, and what Gandhi did inspired Martin Luther King.”

Mandela, Gandhi, King. The names of men who changed the world rang out in the stillness of the barren island where Obama had come to pay his respects.