Before 911, the US stood and watched as Pakistan (especially its intelligence agency) subsidized jihadists in Afghanistan and elsewhere. Pakistan also helped those who wanted to fight India in a guerrilla war in Kashmir and attacked the Indian parliament. It also sold nuclear technology to N. Korea, Libya, Iran, and perhaps elsewhere. These things seem bad for not just the US, but for the world. The US intelligence services knew about all this but let it happen, for whatever reason. (In many ways, Pakistan's behavior was an example of "blowback" from the US war against the USSR in Afghanistan.)
After 911, the US elite used carrot and stick (aid and blackmail) to push Pakistan away from these policies. P hasn't moved all the way (and seems pretty unstable), but it has moved in the right direction. I think that some, if not all, of the positive results that people point to as arising from the US invasion of Afghanistan arise from the US elite's changing strategy vis-a-vis Pakistan.
as usual, if there are any experts in the house, I'm willing to stand corrected. -- Jim Devine / "There can be no real individual freedom in the presence of economic insecurity." -- Chester Bowles