A woman holds her son as people celebrate Pakistan's Independence Day on August 14, 2011, in Karachi.

Editor’s Note: Peter Bergen, CNN’s national security analyst, is a director at the New America Foundation and the author of the new book “Manhunt: The Ten-Year Search for Bin Laden – From 9/11 to Abbottabad.”

Story highlights

Peter Bergen: The West looks at Pakistan as a country in dire straits

Despite the politics, Bergen says Pakistan's society is more stable than it first appears

Civil society is stronger and Pakistan has agreed to trade pact with India, he points out

Bergen: Pakistan's military has acted to protect the nation from Taliban threat

CNN  — 

Pakistan can’t get no respect.

In 2007, Newsweek published an influential cover story proclaiming it “the most dangerous country in the world.”

The bill of particulars for this indictment typically includes the inarguable facts that the Taliban is headquartered in Pakistan, as is what remains of al-Qaeda, as well as an alphabet soup of other jihadist terrorist groups.

And in 2011, it became embarrassingly clear that Pakistan had harbored Osama bin Laden for almost a decade, even if unwittingly, in a city not far from the capital, Islamabad.

Peter Bergen

Leading Pakistani liberals are routinely assassinated by militants. Two-time Prime Minister Benazir Bhutto was killed when she returned from exile in 2007.

Around three years later, the governor of Punjab was shot to death by one of his own bodyguards because he had the temerity to suggest, correctly, that Pakistan’s onerous blasphemy laws tend to penalize its tiny Christian minority. The governor’s assassin was feted as a hero by many Pakistanis.

Pakistani scientists have proliferated nuclear technology to the rogue state of North Korea. And Pakistan now has the fastest-growing nuclear weapons program in the world.

Pakistan is also routinely gripped by Sunni-Shia violence, has a serious secessionist movement in the vast gas-rich province of Baluchistan and its financial capital, Karachi, is one of the world’s most dangerous cities.

Add to this toxic brew the fact that Pakistan operates like a tea party paradise; only about 2% of the population pays income taxes, as a result of which the government doesn’t do much of anything for anybody.

Lengthy power cuts are hollowing out Pakistan’s already weak economy, which, at its present 3% growth rate, cannot possibly sustain Pakistan’s youth bulge.

But there is another side to Pakistan that suggests some underlying strengths that don’t make quite as good copy as the Taliban marching towards Islamabad, as they did in 2009.

Those strengths are Pakistan’s maturing institutions.

Pakistan has a largely ineffectual state, but it has a vibrant civil society that picks up at least some of the government’s slack. The private Edhi Foundation, for instance, runs a fleet of 1,800 ambulances and a slew of other welfare services for the poor across Pakistan.

As a result of this strong civil society, Pakistan had its version of the Arab Spring long before the wave of demands for accountable governments emerged in the Middle East. It was, after all, a movement of thousands of lawyers taking to the streets protesting the sacking of the Supreme Court chief justice by the military dictator Pervez Musharraf in 2007 that helped to dislodge Musharraf from power.

Pakistan has a vibrant media. A decade ago, there was only Pakistan TV, which featured leaden government propaganda. Now there are dozens of news channels: many of them conspiracist and anti-American, but many of them also anti-Taliban and pro-democracy.

In the past year, the Supreme Court has taken on the ISI, Pakistan’s powerful military intelligence agency, successfully demanding that the organization produce prisoners who had disappeared for years.

In November, Pakistan agreed to a pact with long-time rival India granting India “most favored nation” trading status; something that would have been unimaginable a few years back. This important development was sanctioned by Pakistan’s powerful army, which is a significant player in the country’s economy and understands that one way out of Pakistan’s economic mess is to hitch itself to India’s much larger economy.

Even U.S.-Pakistani relations – which were at a nadir in 2011 because of a CIA contractor killing two Pakistanis, the bin Laden raid and the death of some two dozen Pakistani soldiers during a NATO airstrike – are gingerly improving. Pakistan has recently reopened the ground routes for NATO supplies to cross Pakistan into Afghanistan, which were closed for months to protest the deaths of the Pakistani soldiers during the NATO airstrike.

Tellingly, Pakistan has never even threatened to close the crucial air corridor across Pakistan that allows U.S. and NATO aircraft to fly into Afghanistan. One can get a sense of how important this air corridor is from the fact that Kandahar Air Field near the Pakistan border in southern Afghanistan is reported to have the busiest runway in the world with some 700 flights landing or taking off there every day.

The present government is the first civilian government in Pakistani history that is poised to complete its full term of office sometime this year or early next year – depending on when the next election is called – without being overturned by a military coup or dismissed in some back room deal. And the military, which has seized power four times in the past six and half decades, has shown no interest in doing so again for the foreseeable future.

The lengthy debate in Pakistan’s parliament that was completed in April about whether Pakistan should allow the United States to use armed CIA drones on its territory is a welcome intrusion of Pakistan’s civilian officials into the national security arena long monopolized by the military. The parliament called for the end of any U.S. drone strikes.

Despite the visibility of the hardline religious parties on the streets of Pakistan, in the voting booth, these parties have recently fared very poorly. A coalition of pro-Taliban religious parties known as the MMA secured control of two of Pakistan’s four provinces in an election in 2002 and 11% of the votes to the National Assembly. But the MMA garnered only a piddling 2% of the vote in the 2008 election.

And where Pakistan’s national interests are at stake, the military is aggressive against the Taliban.

As the Taliban marched three years ago as close as 60 miles to Islamabad, the army launched major military operations in the northern region of Swat and the western area of South Waziristan to end the Taliban’s control of these areas. Pakistani officials are swift to point out, correctly, that as a result, more Pakistani soldiers have died fighting the Taliban than the servicemen of the U.S. and other NATO countries combined.

Pakistan has a myriad of well-known problems, but it also has some residual strengths that often get obscured by rhetoric about the “world’s most dangerous country.”

Pakistan is no North Korea, and if Pakistanis really got a grip on their own problems, rather than too often resorting to blaming the United States or India for their ills, Pakistan might begin to look more like Turkey than Bangladesh.

One good start along this path would be for the government to privatize Pakistan International Airways and the country’s steel mills, which hemorrhage public money and perform quite poorly. But this would require real political leadership, something that is in short supply in Pakistan.

While Pakistan’s institutions are slowly maturing, its political class remains largely moribund.