Afghanistan - An Afghan soldier killed a U.S. servicemember and wounded two Italian soldiers when he opened fire on foreign troops at an army base in western Afghanistan on Tuesday, a senior Afghan army officer said.

The shooting is the latest in a string of such incidents, at a time when Western countries are pouring resources into training Afghan soldiers and police to fight the Taliban insurgency.

The soldier opened fire on the two Italians and one American in a joint Afghan and foreign base, General Khair Mohammad Khawari, a senior officer in western Afghanistan, told Reuters.

Two Italian soldiers were wounded, one American soldier was killed, Khawari said, adding that the Afghan soldier had been wounded when NATO forces returned fire and was now in hospital.

The assailant comes from an area north of the Afghan capital Kabul and is thought to have mental health problems, Khawari added. The Taliban have traditionally had less of a hold in northern Afghanistan but have recently been expanding their reach across the country.

A spokesman for NATO-led forces said a U.S. servicemember had died following a shooting incident in western Afghanistan but declined to comment further.

Italian defense ministry officials said that the attack, which was deliberate and not a case of friendly fire, occurred during a routine supply operation.

One Italian was lightly wounded in the thigh and the other in the hand and leg but both have returned to their duties.

Last month, an Afghan policeman killed five British soldiers at a military compound in southern Helmand province.

The Taliban said he was one of their fighters who had infiltrated the force and the incident prompted Britain to improve its vetting procedure for Afghan police.

(Additional reporting and writing by Emma Graham-Harrison in KABUL; Editing by Alex Richardson)