A man wearing an Afghan army uniform has shot and killed two international service members, according to Nato.
The attack happened at a military base in the south of the country, a statement by the International Security Assistance Force (Isaf) said.
The attacker was killed by coalition troops, Isaf said. The nationalities of the soldiers have not been released.
The incident comes after several Afghan civilians were killed in an attack for which a US soldier has been charged.
An official in the Afghan defence ministry has told the BBC that the attack happened in Helmand province, and that the attacker was an Afghan soldier.
US Staff Sgt Robert Bales, 38, has been charged with killing nine Afghan children and eight adults in their homes in Kandahar province on 11 March.
He could face the death penalty if convicted.
The case has undermined US relations with Kabul and led to calls for Nato to speed up its planned withdrawal of troops from Afghanistan.
Sgt Bales' trial could take years, contrasting with Afghan demands for swift and decisive justice.
The Taliban called off peace talks in the wake of the deadly rampage.