Two U.S. soldiers were killed and four wounded in an attack Wednesday by gunmen wearing Afghan security force uniforms in eastern Afghanistan, U.S. defence officials said.

The officials spoke on condition of anonymity because they were not authorized to publicly discuss details of the attack, which is the latest in a string of incidents in which Afghan troops turned their weapons on their supposed allies.

The officials said four Afghans involved in the attack were killed in the ensuing battle.

The frequency of these insider attacks has declined markedly in recent months. At the height of the problem, in 2012, U.S. and coalition troops were more often fighting and training alongside their Afghan partners; the relationship evolved last year with the Afghans taking a lead combat role. That has put the Americans and other coalition troops in a less visible position as advisers.

The exact circumstances of Wednesday's incident were not immediately available. Two officials said it happened in Kapisa province, east of Kabul.

The international coalition said in a brief written statement in Kabul that two members of the international military coalition were shot to death by two gunmen wearing Afghan uniforms, but it did not provide the nationalities of the dead. Nor did it disclose that a number had been wounded.