Updated

Afghanistan's president on Wednesday relented in his demand for all U.S. special operations forces to withdraw from a strategic province east of the capital, agreeing to a compromise calling for the pull out of one team implicated in abuse allegations that the Americans have rejected.

The dispute underscores the fragile negotiations under way as Hamid Karzai seeks to redefine and expand control of his country as the United States and its allies prepare to end their combat missions by the end of 2014.

Wardak province is viewed as a gateway to Kabul and has been the focus of counterinsurgency efforts in recent years. But Karzai last month ordered all U.S. special operations forces out after local villagers accused Afghan troops working with the Americans there of torture, illegal detentions and other abuses.

The U.S.-led coalition denied the allegations. But NATO said Karzai and Gen. Joseph Dunford, the U.S. commander of all allied forces, had agreed Wednesday to remove a team of commandos and turn over security to government forces in Wardak's Nirkh district, the center of the allegations.

British Army Lt. Gen. Nick Carter, deputy commander of NATO forces in Afghanistan, said it will be "business as usual" for U.S. special operations forces elsewhere in the restive province.

In an interview from Kabul with Pentagon reporters, Carter also described a somewhat vague timeline for the Nirkh transition, saying it will come "once the plan has been put together and there is confidence on all sides that it is possible" for the Afghans to take over security there.

Clarifying an earlier statement from NATO, Carter said the Afghan local police who work with U.S. special operation forces could stay on in some form, possibly paired with elite Afghan troops in place of the Americans -- or they might be replaced by conventional Afghan forces, but that would be up to the Afghan security chiefs to determine.

The deal took more than three weeks for U.S. and Afghan security officials to craft and was reached more than a week after the expiration of the deadline for the U.S. pullout initially set by Karzai.

The compromise came after a string of anti-American rhetoric by the Afghan leader that appears aimed at gaining favor with the Afghan public as he nears the end of his second and final term.

Karzai has long complained the U.S. special operations forces and their Afghan partners have operated outside his control, but he must tread a delicate balance in demanding a faster pace of withdrawal and the continued need for foreign protection.

His demand that U.S. commandos withdraw from Wardak province, for example, raised fears that the move would leave the area and the neighboring capital of Kabul more vulnerable to al-Qaida and other insurgents who are active there.

The agreement will speed the handover of security in the troubled province, faster than U.S. officials and some members of Karzai's own government had recommended or planned.

Carter suggested that the shift in Nirkh will serve as a test for the broad NATO plans to shift security control of the country to the Afghans by later this summer and gradually withdraw U.S. and NATO combat forces by the end of 2014.

"This is a very interesting pilot, if you like, in terms of how transition will occur over the course of the next year or so," he said. "Wardak is probably one of most complicated provinces that we have had to deal with, and how this goes, I think, will be a good bellwether of how the overall transition process works."

Afghan Defense Ministry spokesman Gen. Zahir Azimi said Afghan forces were ready to fill the gap.

"The international forces are ready to withdraw the special forces from Nirkh district of Maidan Wardak province, and Afghan army units are going to replace them in the coming days," Azimi said at a news conference Wednesday in Kabul.

Speaking ahead of the announcement of the deal, Karzai's spokesman Aimal Faizi said Afghan security forces would take control of the entire province eventually, so the gradual transfer "can be a testing period."

Faizi insisted earlier this week that an Afghan-American man working for the U.S. special operations forces was filmed abusing a suspect, on U.S. orders. The spokesman said the video was obtained during an Afghan defense ministry investigation, which was completed over the weekend.

Dunford rejected the abuse charge in an interview Monday with The Associated Press. He said a recently completed U.S. investigation found the interpreter in question was not working with U.S. forces at the time of the incident.

"We've investigated this three times, so I'm confident," Dunford said. "There were no U.S. forces in or around that incident, and the interpreter was not in our employ at the time of the incident."

The U.S. maintains dozens of small special operations posts across Afghanistan intended to help extend security and Afghan government influence to more remote, Taliban strongholds that are beyond the geographic range of the Afghan army or police. American commandos partner with small bands of Afghan Local Police or "ALP," a force roughly 20,000 strong that was created by the U.S., and later incorporated into the Afghan Interior Ministry. While the units work with Americans, they answer to the local district police chief, according to an Afghan security official who spoke on condition of anonymity as a condition of discussing the sometimes controversial program.

But Karzai's national security council has delayed an interior ministry request to recruit and train another 45,000 local police. Karzai believes the units are "outside his control," Faizi said, adding that some members have been caught preying on locals with impromptu checkpoints, or abusing the civilians under their care.

U.S. and Afghan officials point out the Afghan Interior Ministry handed over five local police accused of rape last year for prosecution last year. The men were given lengthy jail sentences. But the United Nations mission to Afghanistan says accountability among the units is uneven, varying from province to province.

With the Wardak disagreement resolved, U.S. and Afghan officials can now work on the delayed transfer of the Parwan Detention Center to the Afghans. Dunford told the AP that the two sides still had to come up with an acceptable way to allow the U.S. to check that the detainees they hand over are being treated humanely, as well as a way to cement Karzai's assurances that 30-40 detainees the U.S. considers dangerous will not be released.

"It's my expectation that Gen. Dunford is making good progress in terms of his discussions with the president on all of this, and that we will be working towards a resolution to the problem during the course of the next week or so," said deputy commander Carter.