This business about Pakistan being our ally is abject nonsense. Most of the country despises us. Musharraf and some of the military have been a fickle ally but they did at least occasionally take the fight to al Qaeda and the Taliban. They didn't do it with abandon, though, precisely because (a) the people of Pakistan oppose it(they are fine with having anti-Western jihadists operating from safe-havens within their country), and (b) Pakistan has always been a strong supporter of the Taliban (which Benazir Bhutto was key to establishing in Afghanistan) for both cultural and geopolitical reasons.
If the rationale for continuing American combat operations in Iraq is, principally, that we cannot allow anti-Western radicals to establish a platform from which they can launch 9/11-style operations, how can we conceivably turn a blind eye to the platform they have in fact established in Pakistan's border region? Try as it might, international law has not (yet) repealed the sovereign right of self-defense. We are not required by anything so vapid as "our standing in the world" to tolerate an al Qaedastan in Pakistan, Iraq, Somalia, or anyplace else.