The discovery and death of Osama bin Laden has raised once again the frightening possibility that a section of Pakistani military intelligence may secretly sympathise with the ideology and objectives of al Qa'eda. This would be frightening because it would in turn raise the possibility that at some stage the Pakistani military may experience an Islamist mutiny in its lower ranks - and if that happens, the Pakistani state could collapse very quickly indeed.
Such a secret plot within the Inter-Services Intelligence (ISI) would be quite different from the shelter given by the military as a whole to the leadership of the Afghan Taliban or its past sponsorship of terrorism against India. These were decisions of the Pakistani high command, made for strategic reasons and endorsed by completely secular officers such as General Pervez Musharraf. They did not reflect ideological sympathy for the groups concerned.
Until now there has never been a military mutiny from below. Every military coup has been carried out by the serving chief of the army staff, including Musharraf, backed by a solid majority of the high command. The loyalty of the military to its commanders is cemented by the material benefits of military service, but also by a deep conviction that it is the discipline and unity of the army that preserves Pakistan as a country.
The further down one goes in the officer corps, the more its members are lower middle class, less westernised and more religious - not surprising because the vast majority of Pakistanis are conservative Muslims. However, in the words of Tanvir Naqvi, a retired lieutenant general: "Officers suffer from the same confusion as the rest of our society about what is Islamic and what it is to be Muslim. The way I have read the minds of most officers, they certainly see this as a Muslim country, but as one where people are individually responsible to God, for which they will answer in the life hereafter, and no one should try to impose his views of religion on them. Very few indeed would want to see a Taliban-style revolution here, which would destroy the country and the army and let the Indians walk all over us."
This is a critically important point. Along with discipline and loyalty, fear of India is drummed into the Pakistani soldier from the first day he enters the military. Quite apart from the hideous internal consequences of revolution and civil war in Pakistan, fear that India would use this to crush the country is deeply felt and deeply credible.
The ISI, however, is a special case within the military. Ever since it was made responsible for channelling US and Saudi aid to the Afghan mujaheddin fighting the Soviets in the 1980s, some of its officers have had close relations with Islamist militant groups and appear to have developed strong personal attachments to them. Moreover, the money that ISI agents creamed off from aid to the mujaheddin gave not just the ISI as a whole but groups within it their own permanent, independent and secret sources of funding.
On the other hand, the ISI like the Pakistani military as a whole has fought hard and suffered badly in the campaign against the Pakistani Taliban, with more than 80 of its officers killed. These include one of the most famous, Colonel Sultan Amir Tarar, also known as Colonel Imam, who was captured by the militants last year and killed in January. The ISI chiefs are themselves senior regular military officers, and the present chief of the army, Gen Ashfaq Kayani, had been director general of the ISI. So it is also highly unlikely that the ISI as an institution would rebel against the military high command.
Given these constraints, for significant parts of the Pakistani military to mutiny, a situation would have to be created in which their obedience to the high command came into direct conflict with their feelings of personal and collective honour as Pakistani Muslim soldiers. The US raid to kill bin Laden would be such a scenario - if US troops were to turn raids into Pakistan into a regular strategy. Were that to happen, then, or so I have been told by officers at every level, sooner or later Pakistani troops would open fire on their US counterparts - and if ordered not to do so, might very well mutiny.
As one retired general explained, drone attacks on Pakistani territory, though the ordinary officers and soldiers find them humiliating, are not a critical issue because they cannot do anything about them.
"US ground forces inside Pakistan are a different matter because the soldiers can do something about them. They can fight. And if they don't fight, they will feel utterly humiliated, before their wives, mothers, children. It would be a matter of honour, which as you know is a tremendous thing in our society. These men have sworn an oath to defend Pakistani soil. So they would fight. And if the generals told them not to fight, many of them would mutiny, starting with the Frontier Corps."
The humiliation felt by Pakistani soldiers at the ease with which the US raid was able to penetrate Pakistani defences has increased the likelihood that future raids will meet a forceful response. And of course if a US force does get into a battle with Pakistani forces and is destroyed, that will raise US public fury at Pakistan to dangerous levels. It is a profound hope therefore that the United States does not make a habit of such raids.
Failing a split in the military, Pakistan is not in nearly as much danger as collapse as much of the western (and some of the Pakistani) media make out. As the army has shown in Swat, Bajaur and elsewhere since 2009, it is capable of defeating and pushing back the Islamist insurgency in Pakistan, and there is no possibility of that insurgency sweeping to power in Islamabad.
Concerning the possibility of mass movements on the streets of Pakistan's cities, Pakistan's democratic system is very weak and corrupt, but it does make the country different to autocracies in the Middle East. Unless a new Islamist mass revolutionary party were to emerge (of which at present there is little sign), spontaneous mass protests on the streets of Pakistan - against price rises, for example - would not lead to the overthrow of the system. The opposition parties would ally themselves with the protests, the government would fall and be replaced by one led by the (equally elite-dominated) Pakistan Muslim League of Nawaz Sharif, a former prime minster, and the system would continue as before.
Kinship is central to the weakness of the Pakistani state, but also to its stability, above all because of its relationship with class. Because the Pakistani political elites, especially in the countryside, rely for their strength not just on wealth but on their leadership of clans or kinship networks, kinship plays a vital part in maintaining the dominance of the feudal elites.
By forcing on the elites a certain degree of responsibility for their followers, and circulating patronage downwards, kinship also plays a role in softening - to a limited extent - class domination. Largely because of the strength of kinship loyalty, Pakistani society is probably strong enough to prevent any attempt to change it radically through Islamist revolution.
However, because the power of these elites depends on their ability to extract patronage from the state and distribute it to their followers, the existing Pakistani political system (which operates under both civilian and military rule) is largely responsible for crippling the ability of the state to invest in education, infrastructure, health care and other social services, and to promote economic development.
The existing Pakistani system is quite good at defending itself and the country against revolution, but it is extremely bad at promoting progress - and in the long run, lack of progress may well prove fatal to Pakistan. For if the political system is stable, Pakistan's population is not. If present birth rates continue, by the middle of this century Pakistan will have a population of about 330 million people - double the population in 2009 and far too many for Pakistan's resources to support.
Anatol Lieven is a professor in the war studies department of King's College London and author of the just-published Pakistan: A Hard Country