Nairobi: US President Barack Obama spoke on behalf of equality for gays in Africa, the continent with the most countries which criminalise same-sex relations.
On a visit charged with symbolism because of Obama's family ties with Kenya, he criticised the homophobia prevalent in many regimes on the continent.
He is the first sitting US president to set foot in this African nation.
In a joint press conference on Saturday with his Kenyan counterpart, Uhuru Kenyatta, Obama said that no country should discriminate against citizens because of their sexual orientation.
When asked by reporters what he thought about the aversion expressed by Kenyan leaders and associations to the recent legalisation of gay marriage in the US, Obama said that his country has a long experience of people being "treated differently under the law".
"When you start treating people differently, not because of any harm they're doing to anybody, but because they are different, that's the path whereby freedoms begin to erode and bad things happen," he said.
In his speech at the Global Entrepreneurship Summit, Obama hailed the surge in economic dynamism of Kenya and of Africa in general.
Obama, who was brought up by his mother in the absence of his father, particularly praised the work of women entrepreneurs.
This is Obama's fourth trip to sub-Saharan Africa during his presidency.
He will also visit Ethiopia this time around to meet with a number of African leaders and address the African Union.