Image caption Gen Dempsey has now left Afghanistan on another plane

An insurgent rocket attack on a US air base in Afghanistan has damaged the plane of America's top military officer while he was on a visit there.

Gen Martin Dempsey, chairman of the US Joint Chiefs of Staff, was not near the plane at the time but two US maintenance crew were slightly injured.

The attack happened late on Monday night at the US air base in Bagram.

He was in Afghanistan to discuss a growing number of attacks against Nato soldiers by Afghan security personnel.

Gen Dempsey had arrived on Monday in a C-17 transport aircraft which was parked at Bagram.

A statement from Nato's Isaf force said shrapnel from "an indirect fire round" had damaged the plane as well as a Nato helicopter.

The general was in his room at the time of the attack, according to officials.

"He was nowhere near the aircraft. We think it was a lucky shot," Nato spokesman Col Thomas Collins is quoted as saying by Reuters news agency.

Gen Dempsey had left Afghanistan by Tuesday morning using another plane.

There have been insurgent attacks against the heavily fortified base, located about 30 miles (50km) north of Kabul.

In May 2010 militants launched a co-ordinated assault on Bagram, injuring several Nato troops. Two US soldiers were killed in a similar attack in June 2009.

Gen Dempsey's visit to discuss so-called "green on blue" killings came after an incident on Sunday in which an Afghan in a police uniform shot dead a Nato soldier.

The victim was the 10th US soldier to die in such an attack in two weeks

Nato forces are due to withdraw combat troops in Afghanistan by the end of 2014, with only training troops remaining.