President Barack Obama had been warned by African politicians and religious leaders to avoid the issue of gay rights during his trip to the continent, arguing that any pro-LGBT rights stance would be met with disapproval.
Yet the 44th President of the United States has made LGBT rights a strong part of his second term in office after he became the first sitting US president to publicly favour gay marriage in 2012 and then referencing the Stonewall riots in his 2013 inauguration speech.
At a press conference with the Kenyan President Uhuru Kenyatta, Mr Obama spoke movingly about the cause of gay rights, comparing the plight of homosexuals to the battle against slavery and segregation in the USA. He said he was "painfully aware of the history when people are treated differently under the law.
"That's the path whereby freedoms begin to erode and bad things happen. When a government gets in the habit of treating people differently, those habits can spread."
In Kenya, gay sex is punishable by up to 14 years in prison and gay people in the country regularly talk about violent harassment. However, despite Mr Obama's stance on the issue, Mr Kenyatta resolutely stuck to his line on the cause of LGBT rights.
He said that while Kenya and the US share some values - democracy, value for families, entrepreneurship - there were "some things that we must admit we don't share.
"I repeatedly say that for Kenyans today the issue of gay rights is really a non-issue. We want to focus on other areas…maybe once, like you, have overcome some of these challenges, we can begin to look at other ones, but as of now the fact remains that this issue is not really an issue that is at the foremost minds of Kenyans and that is a fact."
Mr Obama also discussed corruption and counterterrorism with Mr Kenyatta during his visit to Kenya. Members of the US President's family also joined him for a state dinner on his visit to the country where his father was born. Mr Obama promised he would be joined on a return trip by Michelle Obama and his daughters Malia and Sasha.
President Obama is now in Ethiopia talking with politicians about counterterrorism, human rights and regional security issues, including the crisis in South Sudan.