From the American standpoint, though, it has exposed a new level of futility in the war effort here. Not only has Washington failed to persuade Pakistan to stop using militants to destabilize its neighbors — a major American foreign policy goal in recent years — but its failure also appears to have persuaded Afghanistan to try the same thing.

Worse still, for American officials, was the Afghans’ choice of militant allies. Though the Afghan and Pakistan Taliban are operationally distinct, they are loosely aligned; the Pakistani insurgents, for instance, pledge allegiance to Mullah Muhammad Omar, the founder of the Afghan Taliban. In the estimation of American officials, support for one invariably bleeds into assistance for the other.

At the same time, the Pakistan Taliban shares its base in the tribal areas of Pakistan with a number of Islamist groups that have tried to mount attacks in the West, including the remnants of Al Qaeda’s original leadership. The Pakistan Taliban have also showed a willingness to strike beyond the region, unlike the Afghan Taliban. Mr. Mehsud, for instance, is suspected of having a role in the foiled plot to detonate a car bomb in Times Square in 2010, American officials said.

American officials said they were also worried that the Afghan actions would give credibility to Pakistani complaints that enemies based in Afghanistan presented them with a threat equivalent to the Afghan insurgency. No one in the Western intelligence community believes the comparison to be anywhere close, given that the Afghan Taliban insurgency, with help from its Pakistani allies, has killed tens of thousands of people in Afghanistan in the past 12 years, including more than 2,000 Americans.

“What were they thinking?” said one American official of his Afghan counterparts.

Both Afghan and American officials said the Afghan plan to aid the Pakistan Taliban was in its preliminary stages when Mr. Mehsud was seized by American forces. But they agree on little else.

American officials interviewed about the raid say they saved Afghanistan from folly. Pakistan’s use of militants has left that country torn by violence with group after group spinning out of the government’s control — the Pakistan Taliban being Exhibit A. The Americans also said it was not clear how much help the Afghans could actually provide the Pakistan Taliban.

In the Afghan telling, the theft of their prized intelligence asset is an egregious example of American bullying, and President Hamid Karzai remains furious about it. Afghan officials assert that Mr. Mehsud’s continued detention could still derail a pact to keep American troops here beyond next year, despite the progress toward reaching a deal made during talks this month between Mr. Karzai and Secretary of State John Kerry.