Closing out a historic visit to the land of his father's birth, Obama said Kenya has come so far in just his lifetime, but can go even further.
"You can choose the path to progress, but it requires making some important choices," he said in a speech to several thousand Kenyans packed into an indoor arena here in Kenya's capital, a normally bustling place that largely has been on lockdown during Obama's stay.
Thousands more Kenyans lined Obama's motorcade route to the arena and his roughly 40-minute speech was broadcast on TV.
Obama became the first sitting U.S. president to visit Kenya with his arrival last week, years after he was first elected in 2008 and after many Kenyans had grown restless waiting for the man they consider a local son to return. Obama previously had come in 2006 when he was a U.S. senator.
He was introduced at the arena by Auma Obama, his sister on his father's side of the family, who presented him to the audience as "my brother, your brother, our son."
The president traced the history of Kenya's evolution, from colonialism and isolation to independence and global engagement since it won independence from the British just over 50 years ago, in December 1963.
But Obama said challenges remain. He urged Kenyans — particularly its future leaders — to deal with corruption and tribal conflict, create opportunity for all, improve education and health care, treat women better and confront the threat of terrorism.
"When it comes to the people of Kenya, particularly the youth, I believe there is no limit to what you can achieve," he said. "Because of Kenya's progress — because of your potential — you can build your future right here, right now."
The speech struck many of the same notes that Obama has hit in remarks during past visits to Africa, urging the continent's leaders to shape up and not look to others to determine their destiny.
He said corruption was not unique to Kenya but described the pervasiveness of it in Kenya as a "cancer" that is holding back every aspect of economic and civic life like an "anchor."
Obama noted Kenya's booming economy — it has one of the fastest-growing economies in Africa — and asked that the country's economic gains be shared more broadly with all Kenyans.
He urged an end to old tribal and ethnic divisions that he said are "doomed to tear our country apart" and urged Kenya's leaders, as he did President Uhuru Kenyatta during their meetings on Saturday, to confront the terrorist threat posed by al-Shabab militants based across the border in Somalia. The group has killed scores in Kenya in brazen attacks carried out in the past two years.
Obama also pressed for more tolerance and respect of women and girls, calling for an end to violence against women, forced marriages for girls who should otherwise be attending school, sexual assault and the tradition known as "genital mutilation."
"These traditions may date back centuries. They have no place in the 21st century," he said.
Kenyatta has taken steps to tackle corruption by suspending four Cabinet secretaries and 16 other senior officials amid an investigation into allegations of dishonesty. But the suspensions have been met with skepticism by the public because past suspensions of senior officials haven't resulted in anyone being convicted of a crime. Some officials even returned to their jobs before investigations were complete.
Kenyatta has been under public pressure to act following reviews of his 2-year-old regime, published in local media by opposition and economic experts, claiming that his administration is more corrupt than previous governments.
Even before arriving last week, Obama tried to rein in Kenyans' sky-high expectations for his trip.
Red carpets and heavy security are standard for presidential trips, but family streaming in from the countryside for a reunion isn't. Obama said he had a good time catching up with his extended family over dinner Friday night. Auma Obama met him at the airport and rode in the presidential limousine with him to dinner, in addition to accompanying him to Sunday's speech. Relatives also attended a Saturday state dinner for Obama.
Obama met with African youth and civic leaders and was interviewed by a local radio host before departing Kenya. He vowed on Saturday to return once he is free of the trappings of the presidency that he says have made it difficult to visit family here.
His next and final stop is Ethiopia, another Horn of Africa nation that is getting its first visit by a sitting U.S. president.
Obama planned meetings with Ethiopia's president and prime minister, and a separate session with the leaders of Ethiopia, Kenya and Uganda to discuss the situation in South Sudan, which has been gripped by turmoil since a civil war broke out in December 2013.
Obama will also speak to the continent from the headquarters of the African Union, which plays a role in peace and security throughout Africa.
It will be the first time an American president addresses the AU.