Prince William visited British troops in Kenya on Sunday, participating in a training exercise north of the capital Nairobi.

The second in the line to the throne — who served in the British military from 2006-2013 ending his career as a Royal Air Force rescue helicopter pilot — visited in combat fatigues in his role as Colonel General of the Irish Guards, a British Army infantry unit.

He joined more than 100 soldiers in the bush for military drills.

"For us today is really about an Irish guards officer visiting the Irish guards in his capacity as colonel of the regiment. He's always welcome and its lovely when he comes to see us," said Lt. Col Jonathan Palmer, commander of the 1st Battalion Irish Guards, stationed in Nanyuki, some 200 km from Nairobi.

William also met Kenyan military officials, local politicians and ranchers. He visited a school where he was greeted by dancing schoolchildren and played soccer with pupils.

Kenya is the last stop of a tour of Africa for William, which also included visits to Tanzania and Namibia.