Abdul Sattar Bariz, the deputy governor of the northern province of Faryab, said the two soldiers were killed at border check post where they were instructing newly recruited Afghan police personnel.
There were, however, conflicting accounts of who the perpetrator might have been.
The Nato-led International Security Assistance Force said it was investigating the shooting, which it said was carried out by "an individual in an Afghan Border Police uniform."
But General Habib Sayedkhel, a senior border police official, said the shots that killed the soldiers were fired from a nearby house.
"After the shooting the soldier jumped down and ran away to save his life," he said. "There was no evidence that he killed the Americans." (read more)