An Afghan pilot has shot and killed eight coalition troops and one civilian contractor in the worst incident yet of Nato lives being taken by "rogue" members of the country's embryonic security forces.

The incident in Kabul happened as most of the country's pilots and top brass were elsewhere, meeting to discuss plans for Thursday's Victory Day national celebrations.

It is yet another setback for western hopes of handing over security duties to the Afghan army and the seventh time this year that coalition or Afghan soldiers have been killed by members of the Afghan security forces or by insurgents posing as soldiers or police officers.

The incident happened just before 11am on Wednesday in the Kabul headquarters of Afghanistan's newly created air force when a 45-year-old veteran pilot called Ahmad Gul turned his gun on his foreign colleagues.

The International Security Assistance Force officers, who were probably all American, were sitting in an office in a secure building so none of them would have been wearing protective body armour, although all US military personnel always carry a handgun or have a rifle near at hand.

Gul was killed when gunfire was returned.

A spokesman for the air force said people in the building thought an attack had been launched on the sprawling campus of hangars and offices, which shares the same runway as the Afghan capital's civilian airport. "Some of the other officers thought it was suicide bombing and they jumped out of second floor windows to try to escape," said Lieutenant Colonel Bahadur.

Afghan defence ministry officials said the killer opened fire after an argument with his foreign mentors.

Zabiullah Mujahid, the Taliban's spokesman, was quick to send text messages to journalists saying the killing had been carried out by an insurgent sympathiser.

There was no way to verify the claim and Mujahid has a long track record of claiming responsibility for incidents that had nothing to do with the insurgents.

Although the defence ministry said Gul had 20 years' experience with the air force, one Afghan pilot contacted by the Guardian said Gul had only rejoined five months ago, working in a management capacity after being out of work for 10 years.

The pilot said Gul had flown helicopters in the 1980s during the regime of the communist president Mohammad Najibullah, but he stayed out of the factional fighting that followed the fall of his regime in 1992.

Another colleague of Gul's described him as friendly but very religious.

Tensions can and do flourish between Afghan soldiers and their often frustrated international trainers. Last year, the Guardian spent two days at the Kabul headquarters of what was then merely the Afghan army's air corps. US air force trainers were struggling to create a modern force in their own image from a group of largely middle-aged pilots originally trained by Soviet advisers in the 1980s.

When the Russians withdrew, many went to fight for various factional leaders in the civil war, developing an approach to aircraft maintenance and safety that horrified their new American advisers.

Some of the mentors also complained about widespread corruption, with air force commanders accused of diverting important missions in order to pick up paying passengers or siphoning off fuel to sell on the open market.

In early 2010, one US air force colonel working with Afghan pilots said he always kept his handgun loaded at all times after a helicopter he was co-piloting came under fire from an Afghan soldier.