The shooters died when NATO service members returned fire, according to the statement, which did not identify the nationalities of those killed. The incident happened in Helmand province.
While more than 30 countries contribute troops to NATO's 13,195-person mission in Afghanistan, more than 6,800 are American.
Violence has worsened throughout the country in recent years as NATO withdraws and Afghan forces struggle to hold ground in the face of militant offensives. Insider or so-called green-on-blue attacks have punctuated the deteriorating security environment.