Two Americans including a civilian were killed when a gunman opened fire near a NATO base in Kabul Wednesday, the military coalition said, with Afghan officials calling it an "insider attack".
No insurgent group has so far claimed responsibility for the attack, which highlights growing insecurity in Afghanistan as the Taliban step up their nationwide insurgency.
"One US service member and one US civilian died as a result of wounds sustained in Kabul today," NATO said in a statement, adding that three other Americans were wounded in the incident.
"The two individuals were killed during an attack near a coalition base by an unknown assailant, who was later killed."
An American official said the shootout occurred at a military ammunition supply point near Camp Morehead, a base used for Afghan commando training.
Defence ministry spokesman Dawlat Waziri earlier indicated it was a so-called insider attack, saying one NATO soldier had been killed and five others were wounded by a gunman wearing military uniform.
NATO said the Americans were conducting duties as part of their mission to train, advise and assist Afghan forces when they came under attack, adding that an investigation had been launched into the incident.
"Anytime we lose a member of our team, it is deeply painful," said General John Nicholson, the top US and NATO commander in Afghanistan.
"Our sympathies go out to the families, loved ones, and the units of those involved in this incident. To those who continue to target coalition forces... (we) will continue to pursue our mission to help our partners create a better Afghanistan."
So-called "green-on-blue" attacks -- when Afghan soldiers or police turn their guns on international troops -- have been a major problem during NATO's long years fighting alongside Afghan forces.
Gunmen wearing Afghan military uniforms shot dead two Romanian soldiers in the southern province of Kandahar in May.
In a similar attack in August last year, a man wearing an Afghan military uniform shot dead two American soldiers in the southern opium-rich province of Helmand.
And in April last year an American soldier was killed in a firefight between US and Afghan troops in eastern Afghanistan.
Western officials say most such attacks stem from personal grudges and cultural misunderstandings rather than insurgent plots.
The killings have bred fierce mistrust between local and foreign forces even as the rate of such incidents has dropped in recent years.
NATO troops have adopted special security measures in recent years to try to counter the threat.
Insider attacks have also plagued Afghan troops, depleting morale and causing mistrust within security ranks.
In September, two Afghan soldiers with suspected Taliban links killed at least 12 of their comrades as they slept in the volatile northern province of Kunduz.