NAIROBI - US President Barack Obama wraps up a two-day landmark visit to Kenya on Sunday, boosting business and security ties but with firm messages on gay rights and corruption.
Obama, who meets Sunday with members of Kenya's vibrant civil society - bearing the brunt of what they say are increased restrictions as Kenya fights its own "war on terror" - is to make a keynote address to the country.
Somalia's Al-Qaeda-affiliated Shebab have also been at the top of the list of security concerns during the visit, with Obama and Kenyan President Uhuru Kenyatta pledging greater cooperation in tackling the threat.
Thousands gathered Sunday morning at an indoor arena at Nairobi's Kasarani stadium complex - an area used to hold hundreds of ethnic Somalis during controversial mass arrests following the 2013 Somali-led Shebab assault on the Westgate shopping mall in central Nairobi that killed 67.
Shebab fighters have staged a string of suicide attacks and bombings on Kenyan soil, including the April massacre at Garissa university, in which 148 people died.
"We have systematically reduced the territory that Al-Shebab controls," Obama said in a joint press conference after bilateral talks with Kenyatta on Saturday. "That doesn't mean the problem is solved." But Obama also stressed the importance of protecting basic rights, comparing homophobia in Africa to racial discrimination he had encountered in the United States.
"As an African-American in the United States I am painfully aware of what happens when people are treated differently under the law. I am unequivocal on this," Obama said, openly disagreeing with Kenyatta.
Homophobia is on the rise in Africa, and espousing evangelical Christian values is a major vote winner in many countries. Kenyatta replied by repeating the view that gay rights were unacceptable to Kenyans and therefore "a non-issue".
After pledging stronger business ties and aid for entrepreneurs, he also called for firm action on endemic corruption, calling it "the single biggest impediment to Kenya growing even faster".
Obama arrived in Kenya late on Friday, his first visit as president to his father's birthplace and the first to the East African nation by a serving US leader.
Nairobi has witnessed a massive security operation, with parts of the usually traffic-clogged capital locked down.
He leaves later Sunday for the Ethiopian capital Addis Ababa, where he will also be the first US leader to address the African Union.
'Africa rising, but get tough on corruption'
A presidential visit to Kenya had been delayed while Kenyatta faced charges of crimes against humanity for his role in post-election violence seven years ago. The International Criminal Court has since dropped the case, citing a lack of evidence and accusing Kenya of bribing or intimidating witnesses.
Kenyan Vice President William Ruto, whose ICC trial continues, is also vocally homophobic and recently described gays as "dirty". Obama nevertheless shook his hand on arrival at Nairobi's State House.
On corruption, Obama said ordinary Kenyans were being "consistently sapped by corruption at a high level and at a low level," and called for "visible prosecutions".
"They don't have to be a forensic accountant to know what is going on," Obama said, giving the example of officials driving expensive cars or building houses far above what their salaries would allow.
But he also spoke about the opportunities the continent offers.
"I wanted to be here, because Africa is on the move, Africa is one of the fastest growing regions in the world," he said.
Despite the areas of disagreement, the president said he was delighted to be back in Kenya.
Obama still has extended family in western Kenya, meeting with several who have come to Nairobi for the visit.
"Obviously this is personal for me. My father came from these parts," he told an entrepreneurship summit.
Barack Obama Sr was a pipe-smoking economist who the US leader has admitted he "never truly" knew. He walked out when Obama was just two and died in a car crash in Nairobi in 1982, aged 46.
Obama also spoke about Kenyatta's father - Kenya's first president, Jomo Kenyatta - and his father, who knew each other.
"It would have been hard for them to imagine how their sons might be sitting here today," he said.
But he 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 said.