A video has been released showing US president Barack Obama hitting the dance floor during a state dinner in Kenya.

The video, uploaded to Instagram, shows the US commander in chief participate in a traditional Lipala dance with Kenyan president Uhuru Kenyatta during a dinner at Nairobis state house.

Sauti Sol, a Kenyan band whose updated version of the dance this year has become a hit in the country, were performing the track at the state function. One of the band members filmed the 15-second clip online of Obama participating in the dance and published it online. The video has gone viral and has been liked almost 15,000 times on Instagram.

Obama was in Kenya as part of a four-day visit to Africa, which saw him attend an investment summit in Nairobi and the African Union headquarters in the Ethiopian capital Addis Ababa.

The US President spoke movingly about his fathers homeland during a speech at a sports stadium in Nairobi saying, Kenya is on the move, poised to play a big role, with the shadows of the past replaced by a light of opportunity.

Obama also raised the issue of gay rights to President 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.