"Yes you can," President Barack Obama declared, dusting off his campaign slogan and adapting it for his foreign audience. Speaking to Parliament, he called upon African societies to seize opportunities for peace, democracy and prosperity.
"This is a new moment of great promise," he said. "To realize that promise, we must first recognize a fundamental truth that you have given life to in Ghana: Development depends upon good governance. That is the ingredient which has been missing in far too many places, for far too long."
The son of a white woman from Kansas and a black goat herder-turned-academic from Kenya, Mr. Obama delivered an unsentimental account of squandered opportunities in postcolonial Africa.
And he reached back to an older legacy, that of slavery, as he toured the cannon-lined redoubt where people were kept in squalid dungeons then shipped in chains to America, through a "Door of No Return" that opens to the sea.
"It reminds us of the capacity of human beings to commit great evil," he said from the stark white stone fortifications of Cape Coast Castle, converted to the slave trade by the British in the 17th century.
He spoke with the ramparts and the sea behind him and in the company of his family. Mr. Obama said his girls, in their privileged upbringing, needed to see that history can take such cruel turns.
In his speech to Parliament, the first U.S. black president spoke with a bluntness that perhaps could only come from a member of Africa's extended family.
"No country is going to create wealth if its leaders exploit the economy to enrich themselves, or if 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, even if occasionally you sprinkle an election in there," he said, "and now is the time for that style of governance to end."
He added: "Africa doesn't need strongmen, it needs strong institutions."
Mr. Obama was on a 21-hour visit to the West African nation to highlight that country's democratic tradition and engagement with the West. His visit, his first to sub-Saharan Africa as president, was greeted as a "spiritual reunion" Saturday by Ghanaian legislators.
He, his wife Michelle, their daughters and the first lady's mother toured Cape Coast Castle as a festive crowd of thousands milled outside, pounding drums and dancing in the streets. Mr. Obama smiled and waved, pausing after he exited the motorcade, before disappearing with his family and entourage into the courtyard. Michelle Obama is the great-great granddaughter of a slave who lived in South Carolina but whose African origins are unknown.
Earlier, people lined the streets, many waving at every vehicle of Mr. Obama's motorcade as it headed toward a meeting at Osu Castle, the storied coastline presidential state house, before his speech to Parliament. "Ghana loves you," said a billboard.
The Obama administration sought a wide African audience for the president's speech, inviting people to watch it at embassies and cultural centers across the continent.
The 33-minute address was in part a splash of cold water for Africans who blame colonialism for their problems.
President Obama spoke of the indignities visited upon Africans from the era of European rule. He said his grandfather, a cook for the British in Kenya, was called "boy" by his employers for much of his life despite his being a respected village elder. He said it was a time of artificial borders and unfair trade.
But he said the West is not to blame "for the destruction of the Zimbabwean economy over the last decade, or wars in which children are enlisted as combatants." Nor for the corruption that is a daily fact of life for many, he said.
"Africa is not the crude caricature of a continent at perpetual war," he said. Yet for "far too many Africans, conflict is a part of life, as constant as the sun. There are wars over land and wars over resources. And it is still far too easy for those without conscience to manipulate whole communities into fighting among faiths and tribes.
"These conflicts are a millstone around Africa's neck."
Mr. Obama started his day with typical calm. Wearing a gray T-shirt and gym pants, he walked through the lobby of his hotel almost unnoticed at 7:30 a.m. local time on his way to the downstairs gym for a workout.
A short time later, his motorcade left the hotel, passed under hovering military helicopters and arrived for a delayed welcome ceremony with President John Atta Mills.
"I can say without any fear of contradiction that all Ghanaians want to see you," Mills said. "I wish it were possible for me to send you to every home in Ghana."
The castle visit mirrored ones paid by Clinton and George W. Bush to the slave-trading post of Goree Island, Senegal - with the added impact of Mr. Obama's mixed-race background and history-making election.
In Ghana, too, Mr. Obama followed in Clinton's footsteps. In 1998, a surging crowd cheered Clinton in Accra's Independence Square and toppled barricades after his speech. Clinton shouted, "Back up! Back up!", his Secret Service detail clearly frantic.
President Bush's reception last year was less tumultuous, but equally warm. At a welcoming banquet, then-President John Kufuor noted huge increases in U.S. development aid and AIDS relief - and named a highway after Mr. Bush.
Mr. Obama avoided scheduling large public events, wishing to keep emotions in check in a singular moment in African-American diplomacy.
Mr. Obama flew to Ghana after the G-8 summit in L'Aquila, Italy, approved a new $20 billion food security plan. It aims to help poor nations in Africa and elsewhere to avert mass starvation during the global recession.
He also had a cordial first meeting with Pope Benedict XVI. In their half-hour private audience at the Vatican, the two reviewed Mideast peace and anti-poverty efforts, aides reported. They also discussed abortion and stem cell research at length, subjects of disagreement between them.
By Associated Press Writer Mark S. Smith