Obama Kenya trip
President Obama has raised the matter of gay rights to Kenyan President Kenyatta Reuters

US President Barack Obama has raised the issue of gay rights to Kenyan President Uhuru Kenyatta during his visit to the East African country.

Before arriving in Kenya, Obama had promised to deliver a "blunt message" on gay rights in Africa, and the US president spoke passionately about the issue during a press briefing outside the Kenyan state house.

"If somebody is a law-abiding citizen who is going about their business and working in a job and obeying the traffic signs and doing all the other things that good citizens are supposed to do and not harming anybody, the idea that they are going to be treated differently or abused because of who they love is wrong," Obama said.

The US president also used the example of how African-Americans suffered from discrimination to the plight of gay people in Africa.

Obama said: "When you start treating people differently, not because of any harm they are doing to anyone, but because they are different, that's the path whereby freedoms are eroded."

"And bad things will happen," he added.

Kenyatta responded to Obama's remarks saying that there are many things both Kenyans and the US share, but the acceptance of homosexuality was not one of them.

"There are some things our culture does not accept, for Kenyans today, gay rights is really a non-issue," he said.

"It is very difficult for us to impose on people that which they do," he added.

The two presidents also briefed the media regarding the rest of their discussions on terrorism, the elections in Burundi, corruption and entrepreneurship in Africa.

Gay rights in Kenya are non-existent, with homosexual acts punishable by a maximum penalty of 14 years in imprisonment.

Despite the number of convictions for breaking same-sex legislation being negligible, lesbian, gay, bisexual, transgender and intersex (LGBTI) people face harassment by the police, according to the non-government organisation Kenya Human Rights Commission.

Despite international pressure, successive Kenyan governments have resisted calls to decriminalise homosexuality in the conservative country.

There have been a number of instances of gay people been attacked by mobs with the police not acting to protect the victims.

'Cane the gays'

One such instance was the 2012 attack on a meeting of homosexuals at the Likoni CDF Youth Empowerment and Library Centre, in Mombasa.

According to the Kenyan Daily Nation, religious leaders and village elders stormed the meeting forcing the police to close the meeting.

One of the ringleaders pledged that he would "mobilise the community to cane the gays if they organised such a meeting again".

Earlier in the day, Obama told an audience of entrepreneurs and business people that Africa was on the move and the continent was ripe for investment.

He also laid a wreath outside the memorial for the 1998 truck bombing of the US embassy in Nairobi.

Twelve Americans and 34 local embassy workers died in the blast on the same day the US embassy in Dar es Salaam, Tanzania, was targeted killing 11 people, according to the BBC.