NEW YORK - Afghanistan’s attempt to gain leverage over Pakistan by cultivating an alliance with the Pakistani Taliban was discovered by the United States, which raided a convoy carrying Latif Mehsud, a senior militant leader, and captured him.

“The disrupted plan involved Afghan intelligence trying to work with the Pakistan Taliban, allies of Al-Qaeda, in order to find a trump card in a baroque regional power game that is likely to intensify after the American withdrawal next year.” The New York Times reported on Tuesday, citing US and Afghan officials.

Mehsud was being transported by an Afghan convoy for secret talks last month when US Special Forces, on a tip-off, disrupted the plan and took him in custody, the report said. Mehsud is suspected of having a role in the foiled plot to detonate a car bomb in New York’s Times Square in 2010, American officials were cited as saying.

In public statements, the Afghan government has described Mehsud as an insurgent peace emissary. But the Times, citing Afghan officials, said the ultimate plan was to take revenge on the Pakistani military.

Referring to Afghan officials’ oft-repeated charge that Pakistani military intelligence sheltered and nurtured the Taliban and supported their insurgency against the Afghan government, the report said the Afghan government decided to recruit proxies of its own by seeking to aid the Pakistan Taliban in their fight against Pakistan’s security forces. “And they were beginning to make progress over the past year, they say, before the American raid exposed them,” the Times said.

The US raid angered the Afghan government, and the report said it became the latest flash point in the troubled relationship between Afghanistan and the United States.

The thinking, Afghan officials said, was that the Afghans could later gain an advantage in negotiations with the Pakistani government by offering to back off their support for the militants.

Aiding the Pakistan Taliban was an “opportunity to bring peace on our terms,” one senior Afghan security official said.

From the American standpoint, the report said, 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 destabilise its neighbours — a major American foreign policy goal in recent years — but its failure also appears to have persuaded Afghanistan to try the same thing,” the Times said.

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, it was pointed out. In the estimation of American officials, support for one invariably bleeds into assistance for the other.

At the same time, the report said, the Pakistan Taliban share their base in the tribal areas with a number of 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, it said. Both Afghan and American officials said the Afghan plan to aid the Pakistan Taliban was in its preliminary stages when Mehsud was seized by American forces, the report said, adding but they agree on little else.

The Times quoted Aimal Faizi, a spokesman for President Hamid Karzai, as saying that Mehsud had been in contact with officials from the National Directorate of Security (NDS), Afghanistan’s intelligence agency, for “a long period of time.”

The Pakistan Taliban leader “was part of an NDS project like every other intelligence agency is doing,” Faizi said. “He was cooperating. He was engaged with the NDS — this I can confirm.”

Faizi did not elaborate on the nature of the cooperation. But two other Afghan officials, when asked by the Times why they were willing to discuss such a potentially provocative plot, said Mehsud’s detention by the United States had already been exposed — it was first reported by The Washington Post — ruining his value as an intelligence asset and sinking their plan.

As a consolation, the Afghan officials said they now wanted Pakistan to know that Afghanistan could play dirty as well. One said they would try again if given the opportunity.

Afghan officials dismissed American admonishments about the dangers of working with militants as the kind of condescension they have come to expect. No one in Karzai’s government was naïve enough to believe they could turn the Pakistan Taliban into a reliable proxy, said a former Afghan official familiar with the matter.

“I would describe what we wanted to do was foster a mutually beneficial relationship,” the former official said. “We’ve all seen that these people are nobodies — proxies.”

Another Afghan official said the logic of the region dictated the need for unseemly alliances. The United States, in fact, has relied on some of Afghanistan’s most notorious warlords to fight the insurgency here, the official tartly noted. “Everyone has an angle,” the official said. “That’s the way we’re thinking. Some people said we needed our own.”

Afghan officials said those people included American military officers and CIA operatives. Frustrated by their limited ability to hit Taliban havens in Pakistan, some Americans suggested that the Afghans find a way to do it, they claimed.

So Afghanistan’s intelligence agency believed it had a green light from the United States when it was approached by Mehsud sometime in the past year.

After months of negotiations with Mehsud, the intelligence agency struck an initial deal, two Afghan officials said: Afghanistan would not harass Pakistan Taliban fighters sheltering in mountains along the border if the insurgents did not attack Afghan forces.

Still, the Afghans decided to keep their relationship with Mehsud a secret and did not tell American officials.

An American official briefed on Mehsud’s case said there was “absolutely no way” any American would encourage the Afghans to work with the Pakistan Taliban or do anything that could result in attacks on Pakistani forces or civilians, the official said.

“If they thought we’d approve,” the American official added, “why did they keep it a secret?”