KABUL — An Afghan soldier opened fire at a training exercise in northern Afghanistan on Tuesday, killing two US civilian trainers and a fellow Afghan soldier in the second similar shootout in just a week.

The shooting raised further questions about the quality of the fledgling Afghan army as the international community endorsed a roadmap for President Hamid Karzai for Afghanistan to take security responsibility by 2014.

NATO's International Security Assistance Force (ISAF) said it was investigating whether the gunman, believed to have been an army trainer, turned his gun on his comrades in a deliberate attack or by accident during the basic training exercise.

The shooter also died.

A NATO soldier and an Afghan service member were also wounded at the training facility near Mazar-i-Sharif, the largest city in relatively peaceful northern Afghanistan where Taliban infiltration has been minimal.

"Our joint investigation will find out how such an event could have occurred to help us prevent any future acts," said Afghan defence ministry spokesman Mohammed Zahir Azimi.

"We wish to express our deepest sorrow for the deaths of our colleagues in this tragic event today," he said.

ISAF spokesman Brigadier General Josef Blotz said: "The actions of this individual are not representative of the thousands of men and women who train and fight side-by-side with ISAF everyday."

NATO announced Tuesday that two foreign soldiers had been killed in separate Taliban-style bomb attacks in the country's volatile south, bringing the toll for the year so far to 382, according to an AFP tally.

One week ago, an Afghan soldier killed three British troops on an army base in southern Afghanistan before managing to escape.

US General David Petraeus, who assumed command of NATO troops in Afghanistan earlier this month, has said commanders need to ensure that trust remains solid between Afghan and foreign soldiers in order to defeat the Taliban.

The nine-year Taliban insurgency is now at its deadliest in Afghanistan and the militia have carried out a string of deadly suicide and bomb attacks in the heavily fortified Afghan capital.

Draconian security measures paralysed much of the Afghan capital Tuesday but saw a landmark international conference pass without the kind of attacks that could have deeply embarrassed the Afghan government with the eyes of the world watching.

Nevertheless a rocket attack forced the UN chief's plane to divert from Kabul despite a security lockdown imposed by thousands of troops, according to officials.

Officials said UN Secretary General Ban Ki-moon and the foreign ministers of Sweden and Denmark were delayed arriving after a rocket attack on the airport as they prepared to land.

Sweden's Carl Bildt said on his blog that a plane carrying him and Ban was diverted to the main US base at Bagram, outside Kabul, and they were then flown by helicopter to the capital shortly before the meeting opened.

The Afghan interior ministry confirmed a rocket attack near the airport late Monday but gave no details.

Separately NATO troops said they killed several insurgents allegedly preparing to attack the conference.

They were killed during a raid on a house on the southern edge of the city overnight, ISAF said, suspecting the Taliban of plotting an attack on the conference.

Thousands of Afghan and NATO forces on Tuesday led watertight security measures, shutting roads and banning traffic within several kilometres (miles) of the foreign ministry where the conference was taking place.

The airport was shut to commercial traffic. Monday and Tuesday were declared public holidays and access even for pedestrians was seriously restricted by armed police and soldiers manning makeshift checkpoints and security barriers.

In Kandahar, a man detonated explosives in a wheelbarrow, slightly injuring a passerby, said deputy city police chief, Fazil Ahmad Sherzad.