Declaring Kenya at a "crossroads" between promise and peril, President Barack Obama on Sunday pressed the nation of his father's birth to root out corruption, treat women and minorities as equal citizens, and take responsibility for its future.

Closing his historic visit with an address to the Kenyan people, Obama traced the arc of the country's evolution from colonialism to independence, as well as his own family's history here. Today, Obama said, young Kenyans are no longer constrained by the limited options of his grandfather, a cook for the country's former British rulers, or his father, who left to seek an education in America.

"Because of Kenya's progress — because of your potential — you can build your future right here, right now," Obama told the crowd of 4,500 packed into a sports arena in the capital of Nairobi. But he bluntly warned that Kenya must make "tough choices" to bolster its fragile democracy and fast-growing economy.

Obama's visit here, his first as president, captivated a country that views him as a local son. Thick crowds lined the roadways to watch the presidential motorcade speed through the city Sunday, some climbing on rooftops to get a better view. The audience inside the arena chanted his name as he finished his remarks.

The president left Kenya Sunday afternoon, pausing longer than normal atop the stairs to Air Force One to wave to the crowd, a huge grin on his face. He arrived two hours later in Addis Ababa, the Ethiopian capital, where he met with diplomats at the U.S. Embassy in the evening.

Obama has written emotionally about his first visit to Kenya as a young man nearly 30 years ago, and he recounted many of those same memories in his remarks Sunday. The battered Volkswagen his sister drove. Meeting his brothers for the first time. The airport employee who recognized his last name.

"That was the first time that my name meant something," he said.

The president barely knew his father, who died in 1982 after leaving the U.S. to return to Kenya. However, Obama has numerous family members in the country, including his half-sister Auma Obama, who introduced her brother Sunday.

"He's one of us," she said. "But we're happy to share him with the world."

The bulk of Obama's address was a candid commentary on the East African nation's future. He spent considerable time warning about the risks of government corruption, calling it an "anchor" that could weigh down the country's promising future.

"Too often here in Kenya corruption is tolerated because that's how it's always been done," he said. "Here in Kenya, it's time to change habits."

Kenyan President Uhuru 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 action has 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 address corruption following reviews of his 2-year-old government that claimed his administration is more corrupt than previous administrations.

Obama urged an end to old tribal and ethnic divisions that are "doomed to tear our country apart. He spent significant time imploring Kenyans to respect the rights of women and girls, saying that marginalizing half of a country's population is "stupid." And he called for an end to forced marriages for girls who should otherwise be attending school and the tradition known as "genital mutilation."

"These traditions may date back centuries. They have no place in the 21st century," he said.

The president drew on the recent debate in the U.S. over the Confederate battle flag, a Civil War-era relic that is seen by many as a racist symbol. The killing of nine people at a black church in South Carolina last month prompted a fresh debate over the flag, spurring some states to remove it from government grounds.

"Just because something is a part of your past doesn't make it right," Obama said.

Some of those in attendance for the president's speech said they were inspired by his appeal for progress in Kenya.

Upenbo Abraham, a 23-year-old economics student from an area of western Kenya near Obama's relatives, said he was "encouraged, as a poor boy from a village next to his home." Ezekiel Oduor, an accountant, said Obama was "candid and clear" about Kenya's problems with corruption and his desire to help the country rise "to the next level."

After his speech, Obama met with political opposition leaders, then with a group of African youth and civil leaders on ways to promote civil society efforts. He told the civil society group that "the country is going to be better off" if it can cultivate habits of public participation and freedom.

Obama is expected to offer similar messages about good governance and human rights during his two days of meetings with leaders in Ethiopia. Human rights groups have criticized the president for visiting the Horn of Africa nation, which is accused of cracking down on dissent, sometimes violently.

Obama planned meetings with Ethiopia's president and prime minister, and a separate session with regional leaders to discuss the situation in South Sudan, a young nation gripped by turmoil since civil war broke out in December 2013.

Countering the Al Qaeda-linked al-Shabab in neighboring Somalia also is on the agenda for Obama's meetings with Ethiopian leaders. The extremist threat was made clear anew Sunday when al-Shabab claimed responsibility for a suicide truck bombing at a luxury hotel in Mogadishu, Somalia's capital, that killed eight people and shattered a period of calm in the city.