Tanzanian President Jakaya Kikwete welcomed Obama and his family to the country’s economic capital and port Dar es Salaam, as troupes of traditional dancers clapped and sang.
A guard of honour fired a 21-gun salute, women wearing colourful dresses emblazoned with Obama’s portrait danced, and a smiling Obama looked tempted to join in.
Thousands of excited Tanzanians thronged the road leading from the airport to catch a glimpse of Obama, with the city’s streets decked out in alternating Tanzanian and US flags.
“In Africa we have so many countries, so Obama choosing to come to Tanzania, it makes us feel happy,” said Francis Gedyman, 26, a driver.
“I think maybe he came to Tanzania because we don’t have so much corruption, or war. Here we have peace, and democracy.”
A key road — separating Tanzania’s presidential palace from the glittering blue water of the Indian Ocean — has been renamed Barack Obama Drive.
On the final stop on his tour which has included Senegal and South Africa, Obama held talks with Kikwete and is set to visit the Ubungo power plant, after unveiling a new $7-billion programme to boost African electric power networks.
On Monday, the US leader committed $10 million to fight wildlife trafficking in Africa, where iconic animals such as rhinoceros and elephant are under severe threat from poachers.
He will also lay a wreath at a memorial to those killed in the US embassy bombing in 1998, alongside his predecessor George W. Bush.
Bush is in the country for a forum of regional First Ladies, hosted by his wife Laura, which will also be attended by Michelle Obama.
Obama arrived in Tanzania just three months after a visit by Chinese President Xi Jinping, amid talk of an economic rivalry in Africa between Washington and Beijing.
But his tour has also been overshadowed by the health of his hero Mandela, who has entered a fourth week in hospital where he remains critically ill.
Obama did not see Mandela, but he spent the weekend visiting sites from the revered leader’s life, including the Robben Island prison where the anti-apartheid icon spent 18 years — a visit Obama said left him “deeply humbled”.
Obama stood in the tiny cell once occupied by Mandela on the windswept outcrop near Cape Town, and took his daughters to the lime quarry where the man who would become South Africa’s first black president did back-breaking hard labour.
“Mandela’s spirit could never be imprisoned — for his legacy is here for all to see,” Obama said in a speech at the University of Cape Town afterwards.
“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 — in our own lives, and in the lives of our communities and our countries,” he said.
There has been no update on the health of the 94-year-old Nobel peace laureate since Saturday when South African President Jacob Zuma said he remained “critical but stable”. Few details have been released about his condition or treatment.
Well-wishers continued to stop by at the shrine-like wall of goodwill messages outside the Pretoria hospital where Mandela was admitted on June 8 with a recurring lung infection, although there were fewer visitors than in previous days.
But he decided against rolling up in his massive entourage at the Pretoria hospital where Mandela lies, worried that he would disturb the peace of the man he has described as a “personal inspiration”.
In a strident call for democratic change and good governance during his speech in Cape Town, the US leader used the political legacy of Mandela and South Africa’s emergence from grim years of apartheid rule as proof that freedom will ultimately prevail.
“History shows us that progress is only possible where governments exist to serve their people and not the other way around,” Obama said to loud cheers.