Speaking to a raucous crowd in an indoor arena in the capital Nairobi yesterday, Obama said Kenya needed to ditch "bad traditions", ranging from endemic bribe-taking to domestic violence and sex discrimination.
"Kenya is at a crossroads, a moment filled with enormous peril but also enormous promise," he said in an inspirational address to the nation, which was televised live.
Seeking to leverage his status as a "son of the soil" and his huge local popularity, Obama said his ancestral homeland faced "tough choices" ahead, urging Kenyans to end the "bad tradition" of failing to empower women, while warning that "a politics based only on tribe and ethnicity is a politics doomed to tear a country apart."
"Corruption is not unique to Kenya, but the fact is too often corruption is tolerated because that's how things have always been done," he said. "Just because something is a part of your past doesn't make it right."
More From This Section
Much of Obama's speech stressed his affinity with young Kenyans, a vital group in a country where 60 percent of the population is aged under 24.
"He gets us," said his half-sister Auma, introducing a man she described as "my brother, your brother, our son."
Barack Obama Sr was a pipe-smoking economist who walked out when Obama was just two and died in a car crash in Nairobi in 1982, aged 46.
At a state dinner late yesterday, Obama also joked that some of his critics in the United States no doubt believed he was back in Kenya "to look for my birth certificate", a reference to some in the US who believe he was born abroad. "That is not the case," he laughed.
But the friendly, aspirational message belies a hard-nosed security need.
A young but impoverished population could be fertile ground for instability and the growth of groups like Somalia's Al-Qaeda-affiliated Shebab -- who have also been at the top of the list of security concerns surrounding Obama's stay.