NAIROBI, Kenya (AP) -- President Barack Obama told Kenyans on Sunday that their country is at a crossroads and urged them to "choose the path to progress" by continuing to root out corruption, confront terrorism and be more inclusive of women and girls.

President Barack Obama delivers a speech, in front of American and Kenyan flags, at the Safaricom Indoor Arena in the Kasarani area of Nairobi, Kenya (AP Photo/Ben Curtis)

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 of 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."

Auma Obama, half-sister of President Barack Obama, introduces him prior to giving a speech at the Safaricom Indoor Arena in the Kasarani area of Nairobi, Kenya (AP Photo/Ben Curtis)

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 in the 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, that claimed his administration is more corrupt than previous governments.

(© 2015 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed)