KABUL, Afghanistan (AP) -- A police officer opened fire on U.S. and Afghan forces at a police headquarters in eastern Afghanistan on Monday, sparking a firefight that killed two U.S. troops and two other Afghan policemen. The attacker was also killed in the shootout, officials said.
In a second incident, outside Kabul, U.S. troops fired on a truck approaching their military convoy, killing two Afghan men inside.
The shooting in the eastern Wardak province was the latest in a series of insider attacks against coalition and Afghan forces that have threatened to undermine their alliance at a time when cooperation would aid the planned handover of security responsibility to local forces next year.
The attack also comes a day after the expiration of the Afghan president's deadline for U.S. special forces to withdraw from the province.
U.S. officials have said that they are working with Afghan counterparts to answer President Hamid Karzai's concerns and maintain security in Wardak. Most of the U.S. troops in Wardak are special operations forces.
In Monday's attack, an Afghan police officer stood up in the back of a police pickup truck, grabbed a machine gun and started firing at a U.S. special operations forces-led team and Afghan policemen in the police compound in Jalrez district, said the province's Deputy Police Chief Abdul Razaq Koraishi. Two U.S. special operations soldiers and two Afghan policemen were killed and four others were wounded in the gunfight before the assailant was gunned down, Koraishi said.
It is unclear whether the assailant was targeting the Afghan policemen along with the U.S. special operations forces and whether they were killed by the assailant's bullets or during the crossfire.
The U.S. military said in a statement that two American service members were killed in the shooting. A U.S. defense official in Washington and a coalition official in Afghanistan said 10 Americans -- both special operators and regular soldiers who worked in a combined team -- and at least 12 Afghans were wounded in the attack. The officials spoke on condition of anonymity because they were not authorized to discuss details of the attack with reporters.
U.S. forces were holding five Afghan police officers for questioning, Koraishi said.
Karzai ordered U.S. special operations forces to leave Wardak province, just outside the Afghan capital, because of allegations that Afghans working with the U.S. commandos were involved in abusive behavior. Karzai gave them two weeks to leave, and the deadline expired Sunday.
On Sunday, Karzai accused U.S. forces of working with the Taliban to stage two suicide bombings over the weekend during the visit of U.S. Defense Secretary Chuck Hagel. In a speech, Karzai said the Americans want to scare Afghans into allowing them to stay.
That brought a sharp rebuke from the U.S. ambassador Monday, as news of the insider attack in Wardak emerged.
"The thought that we would collude with the Taliban flies in the face of everything we have done here and is absolutely without foundation," Ambassador James Cunningham said in a statement. "It is inconceivable that we would spend the lives of America's sons, daughters, and our treasure, in helping Afghans to secure and rebuild their country, and at the same time be engaged in endangering Afghanistan or its citizens."
The Wardak shooting is the third insider attack this year.
Afghan soldiers opened fire on U.S. forces at a joint base in eastern Afghanistan last Friday, killing a U.S. contractor and wounding four U.S. troops. A U.S. military official confirmed Monday that the attackers were Afghan soldiers. The official spoke on condition of anonymity because the NATO investigation was not complete.
The pace of incidents is much slower than in 2012, when coalition troops were hit with 46 insider attacks that killed 64 coalition troops and wounded 95, according to a senior coalition intelligence officer. The officer spoke on condition of anonymity because he was not authorized to be publicly identified. By AP's count, at this time last year, there had been eight attacks. In 2011, 21 insider attacks killed 35.
U.S. officials attribute the drop in incidents to measures like better vetting of Afghan security forces, and devoting more resources to counterintelligence -- watching the ranks for discontent. They have also taken steps like dividing U.S. and Afghan forces when stationed on the same bases, and when located together, posting sentries to watch their own sleeping troops.
U.S. forces are also conducting far fewer joint patrols with Afghan troops ahead of the 2014 transition, so there are fewer opportunities for the two to interact.