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 Nairobi's 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.

Obama in Kenya 2015 7
US President Barack Obama (L) arrives together with Kenya's President Uhuru Kenyatta (R) to hold a joint news conference after their meeting at the State House in Nairobi July 25, 2015. Obama told African entrepreneurs in Kenya on Saturday they could help counter violent ideologies and drive growth in Africa, and said governments had to assist by ensuring the rule of law was upheld and by tackling corruption.Thomas Mukoya/Reuters

The US President spoke movingly about his father's 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.