CAPE COAST, Ghana — President Obama traveled in his father’s often-troubled home continent on Saturday, where he symbolized a new political era but brought a message of tough love: American aid must be matched by Africa’s responsibility for its own problems.
“We must start from the simple premise that Africa’s future is up to Africans,” Mr. Obama said in anaddress televised across the continent. For all its previous sins, he said, “the West is not responsible for the destruction of the Zimbabwean economy over the last decade, or wars in which children are enlisted as combatants.”
To build a prosperous future, he said, Africa needs to shed corruption and tyranny and take on poverty and disease.
“These things can only be done if you take responsibility for your future,” he told Parliament in Accra, Ghana’s capital. “And it won’t be easy. It will take time and effort. There will be suffering and setbacks. But I can promise you this: America will be with you every step of the way, as a partner, as a friend.”
The visit of the first African-American president, the son of a onetime Kenyan goat herder, electrified this small coastal nation and much of the region. Thousands of people lined streets, crowded rooftops, packed balconies, climbed trees, leaned out windows, even hung off scaffolding to glimpse his motorcade.
His face was everywhere, from billboards to T-shirts to dresses. His name and campaign theme became the refrains of songs played in his honor.
His one-day stop blended his vision of the future with echoes of the past. He stood in the Door of No Return at Cape Coast Castle, a notorious slave port perched on the windswept sea here where men who looked like him were once held in dungeons until they were marched in shackles to waiting ships. He brought his wife, Michelle, a descendant of slaves, and their daughters, Malia and Sasha.
Mr. Obama, rarely one to display emotion, seemed especially sober. He said the castle reminded him of the Buchenwald concentration camp and underscored the existence of “pure evil” in the world.
“Obviously, it’s a moving experience, a moving moment,” he said. “As painful as it is, I think that it helps to teach all of us that we have to do what we can to fight against the kinds of evils that, sadly, still exist in our world.”
One evil he came here to fight is the pernicious mix of greed, famine and war that has kept Africa down. He delivered a blunt message that from his predecessors might not have been received the same way. Instead, it was cast by aides as hard truths from a loving cousin.
“No country is going to create wealth if its leaders exploit the economy to enrich themselves, or police can be bought off by drug traffickers,” he said. “No business wants to invest in a place where the government skims 20 percent off the top, or the head of the port authority is corrupt. No person wants to live in a society where the rule of law gives way to the rule of brutality and bribery. That is not democracy, that is tyranny, and now is the time for it to end.”
Mr. Obama added: “Africa doesn’t need strongmen. It needs strong institutions.”
The message of responsibility is one that he has conveyed to different audiences, from African-Americans at home to Muslims abroad. In Cairo last month, he said pointedly that even as America needed to better understand the Muslim world, Muslims needed to confront their own anti-American elements.
As in Cairo, he used personal history to soften stern language. “After all,” the president said, “I have the blood of Africa within me, and my family’s own story encompasses both the tragedies and triumphs of the larger African story. Some of you know my grandfather was a cook for the British in Kenya, and though he was a respected elder in his village, his employers called him boy for much of his life.”
Mr. Obama’s first trip to sub-Saharan Africa as president was his fourth to the continent that has played a distant yet central role in his life. When he first came as a college student, he had little more than a backpack and a train ticket. On Friday, he arrived on Air Force One.
But Mr. Obama’s ties to Africa barely go beyond biography. He met his father only once as a child, and was raised largely by his white mother and grandparents. He has written about coming to terms with his biracial upbringing, neither a product of African-American culture nor a native son of Africa.
Despite all the attention, the White House worked to keep his visit relatively low-key. A president accustomed to crowds of hundreds of thousands, Mr. Obama chose instead smaller venues, aware of the chaotic scene when hundreds of thousands of people nearly engulfed President Bill Clinton and injured one another during a 1998 visit.
Still, the excitement was hard to miss. At a breakfast with dignitaries, Mr. Obama made his way down the center aisle with President John Atta Mills while a reggae artist, Blakk Rasta, crooned in the background: “Barack, Barack, Barack Obama.”
An announcer kept up a steady patter of commentary. “The first black president of the United States!” he called out. “Africa meets one of its illustrious sons, Barack Obama.”
Before his speech to Parliament, the legislators were chanting his old campaign slogan: “Yes we can! Yes we can!”
Then Mr. Atta Mills introduced Mr. Obama as a long-lost relative. “You’re welcome. You’re welcome,” Ghana’s president declared. “You’ve come home.”
With a functioning democracy that has managed several peaceful transitions of power, this nation of 23 million is the favorite American success story in sub-Saharan Africa. But the choice of Ghana illustrated how few models there are. Both Mr. Clinton and PresidentGeorge W. Bush came here too. By contrast, Mr. Obama bypassed his father’s native Kenya, a reflection of the instability plaguing it recently.
His approach follows that of Mr. Bush, who was widely credited with doing more for Africa than any previous president. Like Mr. Obama, Mr. Bush tried to frame policy by rewarding good governance and building institutions through programs like theMillennium Challenge Corporation, an antipoverty effort that gave Ghana $547 million in 2006.
Even Mr. Obama, who typically talks about the problems his administration inherited, said he was “building on the strong efforts of President Bush” in Africa. Before flying here, Mr. Obama pressed the world’s rich nations to pool $20 billion over three years to fight hunger, not only by delivering food, but also by teaching struggling farmers how to better grow crops.
He said little about what America would do for Africa, however, focusing instead on what Africa should do for itself. He called on the people of his father’s continent to build the sort of society he never saw, prosperous, democratic, honest and healthy.
“You can do that,” he said. “Yes, you can. Because in this moment, history is on the move.”