An Afghan pilot has killed eight foreign troops and a contractor at a training center near the Kabul airport, according to NATO.

We can confirm there was small-arms fire during this incident, said NATO-led International Security Assistance Force spokesman Major Tim James.

The nationalities of the dead men were not released, pending notification of their families.

The Taliban claimed responsibility for the killings.

Taliban spokesman Zabiullah Mujahid said the gunman was dressed to impersonate an army officer and that others at the training facility allowed him to gain access.

However, a spokesman for the Afghan defense ministry said the gunman was an Afghan military pilot who opened fire on foreigners after an argument.

The Afghan defense ministry spokesman claims the shooter suffered from mental illness.

According to other reports, the gunman was identified as Ahmad Gul, a 50-year-old pilot from Tarakhail district of Kabul province.

The shooter was reportedly a pilot for twenty years.

The attack was the seventh such incident in which Afghan insurgents have targeted either foreign soldiers or Afghan security forces.

The pilot himself was reportedly killed during the shooting.

As the gradual withdrawal of western forces from Afghanistan approaches, the Taliban has accelerated its attacks on government and military installations, in order to undermine their authority and morale.

A BBC correspondent in Kabul sizes up the situation this way: “There are nearly a quarter of a million Afghan security forces and 130,000 coalition troops. They fight together and die together, when facing the Taliban. The Afghan security forces have grown quickly, but given the numbers involved, it's still rare for an Afghan soldier to turn his gun on the men he serves with. In the past two years, 42 foreign troops have died at the hands of Afghans they were mentoring, or Taliban dressed in police or army uniform.”

The BBC correspondent added: “These incidents resonate widely, and are bad for morale. American and British soldiers say that they must remain on their guard -- that they can never fully trust the Afghan soldiers and police they serve with.”