A man in Afghan military uniform opened fire at a British-run military academy near Kabul, killing one soldier and wounding at least 14, officials say.
The Nato soldier who was killed is thought to be from the US, while a German general is among those wounded.
Afghanistan's Ministry of Defence said the Afghan soldier was shot dead after he opened fire.
The BBC understands the shooting at Camp Qargha happened after an argument broke out.
Afghan Defence Ministry sources told the BBC the attacker was a soldier who was recruited three years ago.
A US official, speaking on condition of anonymity, told AP news agency that one US soldier was killed and "about a dozen" of the wounded were Americans.
The training academy is modelled on UK military academy Sandhurst and will be the only British military presence in Afghanistan when operations end this year.
It first took cadets last October.
A UK MoD spokesman said the incident was under investigation "and it would be inappropriate to comment further at this time".
The Nato-led International Security Assistance Force (Isaf) said : "We can confirm that an incident occurred involving local Afghan and Isaf troops at Camp Qargha.
The BBC's David Loyn says the Afghan Ministry of Defence has confirmed that several foreign soldiers have been injured
"The camp, also known as the Kabul ANA Officer Academy, is an Afghan National Security Forces facility. We are in the process of assessing the situation."
General Mohammed Afzal Aman, the chief of staff for operations at the Afghan Ministry of Defence, told Agence France-Presse "three of our officers have been injured, some Isaf troops have also suffered casualties".
The BBC's Afghanistan correspondent David Loyn said he understood that an argument took place late morning or lunchtime between Afghans and an armed Afghan soldier, who opened fire.
It is not clear whether it was in the officers' academy or in another part of the large site at Qargha close to Kabul, where there are several training facilities, our correspondent added.
The academy is set in a long, low ridge of hills close to Kabul.
Its military history syllabus includes the analysis of Afghan tactics in past wars against the British, as well as during the mujahedeen wars against the Soviet army.
There were 10,000 applicants who applied ahead of its first intake.
Shortly after the academy opened there was a shooting incident when an Afghan soldier in a neighbouring barracks opened fire, injuring Australian and New Zealand troops providing security.
There are also troops from other nations at the site, including a large contingent of US soldiers.
Most of the UK's combat troops have already left Afghanistan, and almost all will have left by the end of the year.
The only British troops in Helmand are now at their main base at Camp Bastion, which they will leave later this year.