Further along the border in Paktika Province, Taliban fighters occupied abandoned C.I.A. bases and outposts. A legislator from the region warned me that they would use the positions to project attacks deeper into Afghanistan and even up to Kabul. Some of the most devastating suicide bomb attacks occurred in that province in the months that followed.

Meanwhile, in Pakistan, the Haqqani network, the most potent branch of the Taliban, moved from North Waziristan into the adjacent district of Kurram. From there it continues to enjoy safe haven and conduct its insurgency against American, international and Afghan targets.

Pakistan regards Afghanistan as its backyard. Determined not to let its archrival, India, gain influence there, and to ensure that Afghanistan remains in the Sunni Islamist camp, Pakistan has used the Taliban selectively, promoting those who further its agenda and cracking down on those who don’t. The same goes for Al Qaeda and other foreign fighters.

Even knowing this, it might come as a surprise that the region’s triumvirate of violent jihad is living openly in Pakistan.

First, there’s Sirajuddin Haqqani, the leader of the Haqqani network, and second in command of the Taliban. He moves freely around Pakistan, and has even visited the Pakistani intelligence headquarters of the Afghan campaign in Rawalpindi.

Then there is the new leader of the Taliban, Mullah Akhtar Muhammad Mansour, who has openly assembled meetings of his military and leadership council near the Pakistani town of Quetta. Since he came to power last year, the Taliban has mounted some of its most ambitious offensives into Afghanistan, overrunning the northern town of Kunduz, and pushing to seize control of the opium-rich province of Helmand.

Finally, Al Qaeda’s leader, Ayman al-Zawahri, enjoys sanctuary in Pakistan — one recent report placed him in the southwestern corner of Baluchistan. He has been working to establish training camps in southern Afghanistan. In October, it took United States Special Operations forces several days of fighting and airstrikes to clear those camps. American commanders say the group they were fighting was Al Qaeda in the Indian Subcontinent, a new franchise announced by Mr. Zawahri that has claimed responsibility for the killings of bloggers and activists in Karachi and Bangladesh, among other attacks.