KABUL — The killing of an American serviceman in an exchange of fire with allied Afghan soldiers pushed US military deaths in the war to 2,000, a cold reminder of the perils that remain after an 11-year conflict that now garners little public interest at home.
The toll has climbed steadily in recent months with a spate of attacks by Afghan soldiers and police officers — supposed allies — against NATO troops.
That has raised troubling questions about whether countries in the US-led coalition in Afghanistan will achieve their aim of helping the government in Kabul and its forces stand on their own after most foreign troops depart in little more than two years.
The US military said Sunday that the American service member and a US civilian contractor were killed late Saturday in the Sayd Abad district of Wardak Province.
NATO officials said in a statement that shooting broke out between Afghan Army and coalition troops. They said three Afghan soldiers died ‘‘in an ensuing exchange of fire.’’ NATO did not say whether it considered this an insider attack on foreign forces by Afghan allies.
An Afghan official gave a different account of the attack.
Shahidullah Shahid, a provincial government spokesman, said the fighting started when insurgents attacked a checkpoint set up by US forces in Wardak. He said the Americans thought they were under attack from their allies at a nearby Afghan Army checkpoint and fired on it. The Afghan soldiers returned fire, Shahid said.
Attacks by Afghan soldiers or police — or insurgents disguised in their uniforms — have killed 52 American and other NATO troops so far this year.
‘‘We have to get on top of this. It is a very serious threat to the campaign,’’ the US military’s top officer, Army General Martin Dempsey, said about the insider threat.
The top commander of US and NATO forces in Afghanistan, General John Allen, was blunter. “We’re willing to sacrifice a lot for this campaign, but we’re not willing to be murdered for it,’’ he said Sunday on CBS’s “60 Minutes.’’
The insider attacks are considered one of the most serious threats to the US strategy to exit the country. That strategy has focused on training Afghan forces to take over security nationwide — allowing most foreign troops to go home by the end of 2014.
As part of that drawdown, the first 33,000 US troops withdrew by the end of September, leaving 68,000 still in Afghanistan. A decision on how many US troops will remain next year will be made after the American presidential elections. NATO currently has 108,000 troops in Afghanistan — including US forces — down from nearly 150,000 at its peak last year.
The program to train and equip 350,000 Afghan police officers and soldiers has cost American taxpayers more than $22 billion in the past three years.
The most recent attack came just days after Defense Secretary Leon Panetta said most US and coalition combat units in Afghanistan returned to their practice of partnering with Afghan forces, nearly two weeks after the top US commander put restrictions on such cooperation.
In Washington, Pentagon press secretary George Little said the US administration was not marking the milestone of 2,000 deaths.
‘‘We honor all courageous Americans who have paid the ultimate sacrifice in Afghanistan to make the American people more secure,’’ he said.
In addition to the 2,000 American service members killed since the Afghan war began on Oct. 7, 2001, at least 1,190 more coalition troops from other countries have also died, according to iCasualties.org, an independent organization that tracks the deaths.
According to the Afghanistan index kept by the Brookings Institute, about 40 percent of the American deaths were caused by improvised explosive devices. The majority of those were after 2009, when President Obama ordered a surge that sent in 33,000 additional troops to combat heightened Taliban activity. The surge brought the total number of American troops to 101,000, the peak for the entire war.
According to Brookings, hostile fire was the second most common cause of death, accounting for nearly 31 percent of Americans killed.
Tracking deaths of Afghan civilians is more difficult. Most estimates put the number of Afghan deaths since the war began at more than 20,000.
In recent years, some of those casualties have generated a great deal of criticism from President Hamid Karzai and changed the way NATO forces carry out airstrikes. The overwhelming majority of civilian casualties are caused by insurgents — with the United Nations blaming them for more than 80 percent of the deaths and NATO putting that figure at more than 90 percent.
The 2001 invasion of Afghanistan was launched to target Al Qaeda and its Taliban allies. Kabul fell within weeks, and the hardline Taliban regime was toppled with few US casualties.
But the George W. Bush administration’s shift toward war with Iraq left the Western powers without enough resources on the ground, so by 2006 the Taliban had regrouped into a serious military threat.
Obama deployed more troops to Afghanistan, and casualties increased sharply in the last several years.