Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

NAIROBI, Kenya — President Barack Obama spoke proudly of his Kenyan heritage before a raucous and affectionate crowd in Nairobi on Sunday.

"I am proud to be the first American president to come to Kenya, and of course I'm the first Kenyan-American to be president of the United States," he told the packed sports hall in Nairobi, to the loud cheers of over 4,500 people in the audience. It was the time he referred to himself as such.

PHOTOS: Karibou, Obama! Kenya Welcomes President with Open Arms

The president recalled his first trip to Africa, at the age of 27, when he arrived at the airport and tried to find his luggage. He said, a woman who saw his name asked if Obama was related to his father, whom she had known.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"That was the first time my name meant something and that it was recognized," the president said. He went on to meet "brothers, aunts and uncles ... saw the graves of my grandfather and father."

Obama's father is buried in western Kenya.

But the personal quickly gave way to the practical and political, with Obama pledging to stand by Kenya as it battles terrorism and calling on all Kenyans to stamp out corruption.

"Every shilling that's a bribe could be put in the pockets of someone doing an honest day's work," he said.

Related: Obama Takes Jab at Birther Movement on Kenya Trip

He also mentioned the importance of educating women and recognizing their place in society.

"Treating women as second class citizens is a bad tradition — it's holding you back," he said. "Imagine if you have a team and you don't let half of the team play — that's stupid."

President Barack Obama waves after delivering a speech at Safaricom Indoor Arena, Sunday. On the final day of his visit in Kenya, Obama laid out his vision for Kenya's future, and broad themes of U.S.-Kenya relations. Evan Vucci / AP

The barriers could hardly hold back the crowds after Obama's 45-minute speech.

After Kenya, Obama will travel to Ethiopia, which was brought to its knees in the 1980s by a famine but now has one of the fastest growth rates on the continent.