Insurgents in eastern Afghanistan killed two US soldiers on Saturday, hours after defence secretary Leon Panetta had criticised President Hamid Karzai for failing to recognise the sacrifice of Nato forces.

The soldiers, who were members of a special-operations team, died in a fire-fight in Wardak province, south-west of Kabul. Their deaths bring the number of international troops killed in Afghanistan this year to 296, including at least 257 Americans.

The development came amid a spat between Washington and Kabul over what is seen as failing US commitment to tackling terrorism in Pakistan.

At a press conference on Thursday, Karzai criticised the the White House for concentrating on going after insurgents in his country, rather than militants based across the border. He accused the US of playing a "double game".

Karzai also said Nato was not providing enough weapons for home-grown Afghan forces, suggesting that he might have to appeal to other countries, such as China and Russia, to get them.

The comments drew an uncharacteristically angry response from Panetta. Speaking in Peru on Friday, the defence secretary said the Afghan president should be thanking allied troops rather than criticising them.

"We have made progress in Afghanistan because there are men and women in uniform who have been willing to fight and die for Afghanistan's sovereignty," he told reporters.

"Those lives were lost fighting the right enemy not the wrong enemy and I think it would be helpful if the president, every once in a while, expressed his thanks for the sacrifices that have been made by those who have fought and died for Afghanistan, rather than criticising them."

More than 2,000 Americans have been killed in Afghanistan since the conflict began in October 2001. Tensions between the two countries have worsened amid a spate of so-called "green on blue" attacks, in which members of Nato forces have been killed by insurgents posing as Afghan police or members of the home-trained security force.

Panetta has indicated that this increase in insider attacks will not alter plans for US withdrawal from Afghanistan. American troops are due to be pulled out by the end of 2014, handing the responsibility for security to Afghan forces. However, it is thought that as many as 20,000 US personnel could remain past that date, to assist in training and counterterrorism efforts.