The Duke of Cambridge watched British troops and their Kuwaiti counterparts storm a building during a dramatic military exercise as his tour of the Middle Eastern country ended.

William was an observer as soldiers threw stun grenades into the premises which echoed to the sound of gunfire, albeit blanks, as they ran inside to confront the enemy.

Wearing protective glasses and ear defenders, the Duke had a ringside seat for Exercise Desert Warrior - a drill which would have been familiar to him from his time as an Army officer at the Royal Military Academy Sandhurst.

The Duke of Cambridge at the Sheikh Salim Al-Ali National Guard Camp. Credit: AP

Under the exercise, British troops train alongside Kuwaitis twice a year for four weeks, in a defence and security collaboration that can trace its origins back to the Treaty of Friendship signed between Kuwait and the UK in 1899.

Major Ben Smyth, commander of Malta Company, 2nd Battalion, the Mercian Regiment, hosted William’s visit to the Sheikh Salem Al-Ali National Guard Camp in northern Kuwait, close to the Iraqi border.

Maj Smyth, whose troops are midway through the exercise, said: "As I explained to the Duke, defence forms the cornerstone of the UK-Kuwaiti relationship and this is a fantastic opportunity for us to demonstrate the UK’s enduring commitment to Kuwait.

"I explained to him at a company level our key outcome was wanting to improve that relationship and particularly build relations at a personal level. Defence is a small place and you can bump into each other again and again."

On Monday, the Duke joined litter pickers on a beach on a nature reserve, and was also hosted by the Amir of Kuwait, Sheikh Sabah Al-Ahmad Al-Jaber Al-Sabah, at the Bayan Palace.

In the evening he attended an event in the desert alongside students, young leaders and entrepreneurs.