First for the good news: Pakistan is not about to explode. The Islamic militants are not going to take power tomorrow; the nuclear weapons are not about to be trafficked to al-Qaida; the army is not about to send the Afghan Taliban to invade India; a civil war is unlikely.

The bad news is that Pakistan poses us questions that are much more profound than those we would face if this nation of 170m, the world's second biggest Muslim state, were simply a failed state. If Pakistan collapsed, we would be faced by a serious security challenge. But the resilience of Pakistan and the nation's continuing collective refusal to do what the west would like it to together pose questions with implications far beyond simple security concerns. They are about our ability to influence events in far-off places, our capacity to analyse and understand the behaviour and perceived interests of other nations and cultures, about our ability to deal with difference, about how we see the world.

Pakistan has very grave problems. In the last two years, I have reported on bloody ethnic and political riots, on violent demonstrations, from the front line of a vicious war against radical Islamic insurgents. I spent a day with Benazir Bhutto a week before she was assassinated and covered the series of murderous attacks committed at home and abroad by militant groups based in Pakistan with shadowy connections to its security services. There is an economic crisis and social problems - illiteracy, domestic violence, drug addiction - of grotesque proportions. Osama bin Laden is probably on Pakistani soil.

For many developing nations, all this would signal the state's total disintegration. This partly explains why Pakistan's collapse is so often predicted. The nation's meltdown was forecast when its eastern half seceded to become Bangladesh in 1971, during the violence that preceded General Zia ul-Haq's coup in 1977, when the Soviets invaded Afghanistan, when Zia was killed in 1988, during the horrific sectarian violence of the early Nineties, through sundry ethnic insurgencies, after 9/11, after the 2007 death of Bhutto and now after yet another political crisis. These predictions have been consistently proved wrong. The most recent will be too. Yesterday, tempers were already calming.

Some of the perpetual international hysteria is stoked by the Pakistanis themselves. Successive governments have perfected the art of negotiating by pointing a gun to their own heads. They know that their nation's strategic importance guarantees the financial life support they need from the international community. More broadly, our understanding of Pakistan is skewed. This is in part due to centuries of historical baggage. Though few would quote Emile Zola on contemporary France, Winston Churchill, who as a young man fought on the North-West Frontier, is regularly cited to explain today's insurgency. This legacy also includes stereotypes of "Mad Mullahs" running amok, an image fuelled by television footage that highlights ranting demonstrators from Pakistan's Islamist parties though they have never won more than 14% in an election.

For many Britons, Pakistan represents "the other" - chaotic, distant, exotic, dirty, hot, fanatical and threatening. Yet at the same time, Pakistan seems very familiar. There is the English language, cricket, kebabs and curries and figures such as Imran Khan. There are a million-odd Britons of Pakistani-descent who over four decades have largely integrated far better in the UK than often suggested.

It is the tension between these two largely imaginary Pakistans that leads to such strong reactions in Britain. We see the country as plunged in a struggle between the frighteningly foreign and the familiar, between fanaticism and western democracy, values, our vision of the world and how it should be ordered. Yet while we are fretting about Pakistan's imminent disintegration, we are blind to the really important change.

Recent years have seen the consolidation of a new Pakistani identity between these two extremes. It is nationalist, conservative in religious and social terms and much more aggressive in asserting what are seen, rightly or wrongly, as local "Pakistani" interests. It is a mix of patriotic chauvinism and moderate Islamism that is currently heavily informed by a distorted view of the world sadly all too familiar across the entire Muslim world. This means that for many Pakistanis, the west is rapacious and hostile. Admiration for the British and desire for holidays in London have been replaced by a view of the UK as "America's poodle" and dreams of Dubai or Malaysia. The 9/11 attacks are seen, even by senior army officers, as a put-up job by Mossad, the CIA or both. The Indians, the old enemy, are seen as running riot in Afghanistan where the Taliban are "freedom fighters". AQ Khan, the nuclear scientist seen as a bomb-selling criminal by the West, is a hero. Democracy is seen as the best system, but only if democracy results in governments that take decisions that reflect the sentiments of most Pakistanis, not just those of the Anglophone, westernised elite among whom western policy-makers, politicians and journalists tend to chose their interlocutors.

This view of the world is most common among the new, urban middle classes in Pakistan, much larger after a decade of fast and uneven economic growth. It is this class that provides the bulk of the country's military officers and bureaucrats. This in part explains the Pakistani security establishment's dogged support for elements within the Taliban. The infamous ISI spy agency is largely staffed by soldiers and the army is a reflection of society. For the ISI, as for many Pakistanis, supporting certain insurgent factions in Afghanistan is seen as the rational choice. If this trend continues, it poses us problems rather different from those posed by a failed state. Instead, you have a nuclear armed nation with a large population that is increasingly vocal and which sees the world very differently from us.

We face a related problem in Afghanistan where we are still hoping to build the state we want the Afghans to want, rather than the state that they actually want. Ask many Afghans which state they hope their own will resemble in a few decades and the answer is "Iran". Dozens of interviews with senior western generals, diplomats and officials in Kabul last week have shown me how deeply the years of conflict and "nation-building" have dented confidence in our ability to transplant western values. Our interest in Afghanistan has been reduced to preventing it from becoming a platform for threats to the west. In Afghanistan, as in Iraq, the west has glimpsed the limits to its power and to the supposedly universal attraction of its values.

The west's dreams of a comfortable post-Cold War era have been rudely shaken. We have been forced reluctantly to accept the independence and influence of China and Russia. These are countries that we recognise as difficult international actors pursuing agendas popular with substantial proportions of their citizens. Other countries, particularly those less troubled than Pakistan or Afghanistan, are likely soon to join that list.

This poses a critical challenge in foreign policy. Worrying about the imminent collapse of Pakistan is not going to help us find answers to the really difficult questions that Pakistan poses.