By Hamid Shalizi and Jessica Donati

KABUL, Aug 5 (Reuters) - An Afghan soldier killed a U.S. general and wounded 14 coalition troops in a machinegun attack at a military training facility in Kabul, a top Western and senior Afghan official said on Tuesday.

Both officials spoke on condition of anonymity.

ISAF, the international force in Afghanistan, said the attack took place at a British military training academy in the capital. It said one ISAF service member was killed, without giving details, and the incident was under investigation.

The German military said 14 coalition troops had been wounded, including a German general.

"The wounded German general, whose life is no longer in danger, is being given medical treatment," it said.

Seven other Americans and five British troops were among the wounded, according to the Afghan official.

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

"Today at 12pm, a terrorist in army uniform opened fire on international partners and other Afghan officers, wounding several," an Afghan Ministry of Defense statement said.

The gunman was using a light machinegun according to a U.S. official.

Such attacks have eroded trust between the allies and complicated efforts to train Afghanistan's 350,000-strong security force.

The Taliban says insider attacks reflect their ability to infiltrate the enemy, while ISAF officials say the incidents often arise over misunderstandings or altercations between troops.

In 2012, dozens of incidents forced international troops to take measures to reduce interaction with their Afghan partners and since then, the number of insider attacks has fallen sharply.

In a similar attack on Tuesday, several 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 airstrike hit a vehicle carrying civilians in western Herat province, local officials said, killing four members of one family including two children.

"We strongly condemn the killings by foreign troops and we have reported this to the presidential palace," deputy provincial governor, Aseeluddin Jameh, told Reuters.

"The family was coming back from a wedding in Shindand district when they were hit."

(Reporting by Sabine Siebold in Berlin; Krista Mahr in Kabul; Jalil Ahmad Rezaee in Herat; Ahmad Sultan in Gardez; Editing by Janet Lawrence)