[Probably an Afghan soldier they trained and working side by side with us. Not the first time.]
Infiltrators are always a problem, as are soldiers who are suborned after joining up. It happens a lot in guerrilla wars, and it happened regularly in Vietnam, where almost 300 communist troops, on average, were being killed daily, in combat operations, over a period of roughly 10 years.