A US general has been killed and more than a dozen people wounded in the latest insider attack by a man believed to be an Afghan soldier, according to US, German and Afghan officials.

The identity of the slain general was not immediately released by the Pentagon.

It is believed he was the most senior US military official killed in action in Afghanistan since the war there began in 2001.

Pentagon spokesman Rear Admiral John Kirby told reporters that "many were seriously wounded" and the gunman was killed in the attack.

The incident took place today at the Marshal Fahim National Defense University, which is a training centre in Kabul.

It raised fresh questions about the ability of NATO soldiers to train and advise Afghan security forces as western nations gradually withdraw.

US and German generals were on a routine visit at the time, the Pentagon said.

A US official said the gunman fired on the foreign soldiers using a light machine gun.

Afghanistan's Defense Ministry described him as a "terrorist in army uniform".

The German military said one of its generals was one of 14 coalition troops wounded in the attack. It said his life was not in danger.

Seven Americans and five British troops were among the wounded, an Afghan official said.

Past insider attacks have eroded trust while straining foreign efforts to train Afghanistan's 350,000-strong security force and prepare them to fight the Taliban once most US and NATO forces depart.

Rear Admiral Kirby said the shooting is being investigated jointly by Afghan authorities and the international military coalition that is winding down its long mission in Afghanistan.

The Afghan president was quick to condemn the attack, saying the delegation had been visiting the facility to help build Afghanistan's security forces.

The Taliban says insider attacks reflect their ability to infiltrate the enemy.

International military coalition officials say the incidents often arise over misunderstandings or altercations between troops.

In a similar attack today, several people were wounded in eastern Paktia province when a policeman opened fire on international and Afghan forces, police chief Zalmay Oryakhil said.

Adding to the tension, a NATO air strike hit a vehicle carrying civilians in western Herat province, local officials said, killing four members of a family returning from a wedding, including two children.