Is there any way that the United States can engineer a decent exit from Afghanistan that leaves behind a stable country?

The answer depends on Pakistan.

If Pakistan stops providing the Afghan Taliban and other radical Islamists with safe havens, a stable Afghanistan is possible. Otherwise, Afghan prospects are grim and America's Afghan war is destined to fail.

If you want to understand why, read the newest book by the world's foremost expert on the Taliban, the Pakistani journalist Ahmed Rashid, Pakistan on the Brink: The Future of America, Pakistan and Afghanistan.

Rashid's book is especially important as the United States and Pakistan seek to repair a tortured relationship that nearly ruptured when a U.S. air strike accidentally killed 24 soldiers in November. Last week, the chairman of the Joint Chiefs, Gen. Martin Dempsey, said he hoped a meeting between top U.S. and Pakistani generals would help "reset the relationship."

It's hard to see how.

As Rashid details, the U.S.-Pakistani relationship has long been strained, in large part because of the dishonesty that underlies it. Pakistan blames flawed U.S. policies, which, officials say, have made a mess in Afghanistan that affects their country.

But it is Pakistan's policy of backing radical Islamists that undercuts any chance of an Afghan peace settlement, and threatens to restart a civil war.

The Pakistani military has provided sanctuary to Afghan Taliban factions and their leaders since 2001, Rashid writes, because it regards the Taliban as a hedge in its conflict with India.

Double-dealing has been Pakistan's modus operandi: Former Pakistani President Pervez Musharaf armed and trained Afghan Taliban to relaunch an insurgency in Afghanistan in the mid-2000s - even as he helped the CIA hunt down some al-Qaeda leaders.

Pakistan's ISI intelligence agency considered Afghan President Hamid Karzai too friendly to its archenemy, India. The ISI hoped to restore the Taliban to power in Afghanistan, thus guaranteeing a friendly government along its western border. "Even though many Taliban preferred making their peace with Karzai, the ISI forced them not to do so once the insurgency began," Rashid writes.

The ISI's policies eventually boomeranged. The Afghan Taliban radicalized Pakistani Pashtuns who lived in tribal areas near the Afghan border. These Pakistani militants began threatening their own state, forcing the Pakistani army to attack them.

Rather than address the mistakes that had "Talibanized" its own society, the ISI blamed Pakistan's troubles on U.S. mistakes in Afghanistan, and fed this narrative to its own public. Meantime, the Pakistani government kept publicly denying that it was harboring al-Qaeda leaders or the Taliban.

This policy of deception finally blew up when Navy SEALs killed Osama bin Laden in the Pakistani garrison town of Abbottabad. It is inconceivable that the ISI was wholly unaware of his presence; this alone explains why the U.S. military didn't trust Pakistan enough to inform its officials of the raid.

Yet Pakistan has never apologized to the United States for harboring bin Laden. Instead, the Pakistani army and ISI deflected attention by focusing on the U.S. breach of Pakistani sovereignty.

It is this ongoing dishonesty that makes it hard to see how Pakistan's relationship with America can be reset.

Which brings us back to the question of whether the United States can engineer a successful outcome in Afghanistan and the surrounding region. Rashid believes three elements are necessary: first, a carefully considered Western withdrawal from Afghanistan; second, a political settlement with the Taliban; and third, Pakistan's willingness to rein in Islamic extremism.

On the first point, Rashid rightly contends that U.S. officials have failed to lay out a clear strategic vision for the region after they pull out most troops by 2014.

But on points two and three - which are heavily dependent on Pakistani action - he is equally grim.

So long as the ISI dreams of controlling Afghanistan via its militant Taliban proxies, he sees little chance that peace negotiations can move forward. "As long as the ISI protects key Afghan insurgent groups, a peaceful settlement in Afghanistan is out of the question," he writes. "If \[the Pakistani military\] can't get what they want out of an Afghan settlement then nobody will get an Afghan peace."

Nor does Rashid believe that Pakistan's generals understand they must change a strategy that is outdated. "Ending the Taliban insurgency in their country and helping to stabilize Afghanistan should be a higher priority than countering an imagined Indian threat," he insists.

In an interview in Washington, Rashid told me, with passion: "I'm full of trepidation about my own country. And things are deteriorating very fast in my second love, Afghanistan."

"The foreign policy we've pursued has been totally detrimental to Pakistan," he continued. Clearly, the Pakistani military doesn't yet recognize this.

Unless the generals update their thinking, there's not much hope for better U.S.-Pakistani relations - or for peace in Afghanistan.

E-mail Trudy Rubin at