Peter Bergen, CNN's national security analyst, is a fellow at the New America Foundation, a Washington-based think tank that promotes innovative thought from across the ideological spectrum, and at New York University's Center on Law and Security. He's the author of "The Osama bin Laden I Know: An Oral History of al Qaeda's Leader."
Militant attacks, such as this one in Islamabad on Monday, are turning the Pakistani population against jihadists.
(CNN) -- It hasn't been too often in the past couple of years that you could write about good news from Pakistan. But if there is a silver lining to the atrocities that have plagued the country in the past several years, it is the fact that the Pakistani public, government and military are increasingly seeing the jihadist militants on their territory in a hostile light.
The Taliban's assassination of Benazir Bhutto, the country's most popular politician; al Qaeda's bombing of the Marriott hotel in Islamabad; the attack on the visiting Sri Lankan cricket team in Lahore; the widely circulated video images of the Taliban flogging a 17-year-old girl; and multiple large-scale attacks on Pakistani police and army installations by the Taliban have provoked real revulsion among the Pakistani public.
In fact, historians will likely record the Taliban's decision to move earlier this year from Pakistan's Swat Valley into Buner District, only 60 miles from Islamabad, as the tipping point that finally galvanized Pakistan to confront the fact that the jihadist monster it had helped to spawn was now trying to swallow its creator.
The subsequent military operation to evict the Taliban from Buner and Swat was not seen by the Pakistani public as the army acting on behalf of the United States as was often the case in previous such operations, but something that was in their own national interest.
Support for Pakistani army operations against the Taliban in Swat has increased from 28 percent two years ago to 69 percent today.
In fact, arguably not since the Soviet invasion of Afghanistan in 1979 have American strategic interests and Pakistani strategic interests been so closely aligned.
This month it looks virtually certain that the Pakistani military will launch an operation into the tribal regions of Waziristan against the militants based there, who have long provided a haven to al Qaeda. That comes on the heels of an aggressive American drone campaign in the Waziristan region that Pakistani leaders have privately encouraged.
And the militants are losing the war of ideas in Pakistan. Support for suicide bombing has dropped from 33 percent to 5 percent in Pakistan over the past several years. The number of Pakistanis who feel the Taliban and al Qaeda operating in Pakistan are a 'serious problem" has risen from 57 percent to 86 percent since 2007.
When Baitullah Meshud, the Taliban leader who had unleashed his suicide bombers across Pakistan in the past two years, was killed two months ago in a U.S. drone strike, the tone of the Pakistani media coverage was celebratory. "Good Riddance, Killer Baitullah" was the lead headline in the quality Dawn newspaper.
The changing attitudes of the Pakistani public, military and government constitutes arguably the most significant strategic shift against al Qaeda and its allies in the past several years. It will have a direct impact on the terrorist organization and allied groups that are headquartered in Pakistan.
What does this mean for Obama's "Af-Pak" plan? Well, the newly hostile attitude of the Pakistanis to the armed religious zealots on their lands has not translated into any great love for the United States, which is consistently viewed unfavorably by large majorities of them.
As the debate about Afghanistan in the White House moves forward, one important factor in that discussion must be the hostility of the Pakistanis to a large additional troop deployment in neighboring Afghanistan. This is particularly important in light of the fact that the Pakistani military is doing what the U.S. government has hoped for for several years, which is taking newly aggressive steps against important elements of the Taliban in Waziristan.
However, changing attitudes in Pakistan do not mean, for the moment, that the Pakistani military will do much to move against the Taliban groups based on their territory that are attacking U.S. and other NATO forces in Afghanistan, such as Mullah Omar's Quetta shura, the Haqqani network and Gulbuddin Hekmatyar's Hezbi-Islami.
Every silver lining in Pakistan must also have a cloud.
The opinions expressed in this commentary are solely those of Peter Bergen.