Pakistan’s longstanding ties to the Taliban were born from the Afghan civil war of the 1990s, when Islamabad saw the Pashtun group as a valuable proxy against other warring factions that had the support of India. That relationship was radioactive after the Sept. 11 attacks, when it became obvious that Al Qaeda had planned the strikes from a safe haven the Taliban had provided for the terrorist group.

The Bush administration forced Pakistan to make a stark choice: Sever ties with the Taliban and become a partner in America’s planned war against global terrorism, or possibly become a target of that war.

Mr. Musharraf and his successors held up part of the bargain: working with the C.I.A. to hunt down Qaeda operatives in Pakistan and allowing the spy agency to unleash a withering drone campaign in the country’s tribal areas. But Islamabad never fully cut ties with the Taliban, and the country’s military intelligence agency, the Directorate for Inter-Services Intelligence, spent years covertly supporting Taliban fighters in Afghanistan and shielding some of the group’s leaders inside Pakistan.

Today, some Pakistani officials argue that the Taliban is far different from the fanatical band once led during the Sept. 11 era by Mullah Mohammed Omar. The group is more pragmatic, they say, understanding the importance of political influence in a power-sharing arrangement. One senior Pakistani intelligence official in Islamabad described the Taliban simply as a political party.

It is Pakistan’s assessment, they say, that the Taliban struck a deal from a position of strength: The United States felt compelled to leave a war that the Taliban could have continued fighting for years. The senior Pakistani intelligence official did not hide what was his country’s primary focus in Afghanistan: The use of Afghan soil in collaboration with India is a red line, the official said.

The intelligence agency’s support for the Taliban strained — and eventually ruptured — America’s relationship with Pakistan, a longtime ally that the United States saw as a bulwark against Soviet expansion during the Cold War.