Pervez Musharraf's resignation as President on Monday saved Pakitan a great deal of trouble. It was obvious that no one, absolutely no one, really wanted to drag Musharraf through impeachment proceedings. The cost to the nation could have been terrible; and beyond Pakistan, the impeachment would have hurt all authoritative regimes in the Islamic world of which there is no scarcity. No wonder the rulers of Saudi Arabia have stepped forward to bring about a settlement amongst the contending parties.

Musharraf's exit may not augur well for India in the near future because he was adept at keeping the pot from boiling over. He learnt quickly in the wake of the attack on Parliament and drew away in time from what could have been a first class disaster for the sub-continent. President Musharraf was no friend of India but he was no worse than other democratically elected leaders of Pakistan.

The Kargil caper took place during the prime ministership of Nawaz Sharif, though he did make some exculpatory noises when in exile. The late Benazir Bhutto [Images] showed some contrition for what happened in the Kashmir valley in 1990s when she was the prime minister, but her changed attitude remained un-vindicated. In any case no one need take politicians in exile at their word.

What with a democratically elected prime minister in charge of Pakistan, and even more, the sequence of events that brought him to power, a three-part makeover -- reconstruction and renewal exercise -- is going on in Pakistan at present.

President Musharraf had almost run out of his 'tenure' as the CEO of Pakistan. This facilitated the first part of the makeover, namely, the transition to a democratically elected government. The politicians in Pakistan had been emboldened and inspired by the popular mood in the wake of Bhutto's assassination, and they did manage to keep out of power the 'king's party'. That does not necessarily mean that another takeover by another army chief may unduly discomfit the people in Pakistan who may well fear that the elected governments may not be able to maintain the minimal order essential for daily life to go on. The blame for the present scarcity of food and inflation may be attributed to the elected government by those who are waiting in the wings.

The elected government has already been shown a 'yellow card' by US President George W Bush [Images]. The visit of Pakistan Prime Minister Yousuf Raza Gilani [Images] from July 27 to 30 was terribly embarrassing. He was bluntly quizzed by Bush about who controlled the Inter Services Intelligence. The US had also expressed reservations about sharing intelligence with Pakistan because the shared information seemed to find its way to the terrorists themselves. This, of course, was in the context of the protest by Pakistan against the US forces striking directly in Pakistani territory. The prime minister and his delegation were reduced to a steady diet of humble pie served to them by all their US hosts.

Unfortunately for Gilani, his humiliation seemed to have been scripted in Pakistan itself. The evidence, left behind by the suicide bomber at the Indian embassy at Kabul on July 7, linked Pakistan to the blast in an unmistakable manner. As was expected, the US forensic experts got into the act, fixed the identity of the Pakistani bomber, the source of the material used, and disseminated the information to all concerned including India. It could not have been otherwise, since the definitive clues left at the site could only have been traced to the ISI.

Whosoever had planned the blast had catered for a time lag of about three weeks for the US to arrive at its conclusion, so that the Pakistani prime minister was suitably positioned to take the full blast of the US broadside. Did the ISI itself engineer this denouement for the Pakistan prime minister's visit? Or was it a faux pas?

As if this was not enough, the reports of bombings in two Indian cities, the breach of the Line of Control [Images] in Jammu and Kashmir [Images], for the first time since the 2003 ceasefire understanding with India, were pouring in during the visit. And all of them generally pointed in the same direction -- Pakistan. Was Gilani set up by the ISI? But why would the ISI resort to such a ploy?

The second element of the present makeover that Pakistan seems to be undergoing is the notion of rule of law, or civil society. Except for a section of opinion makers in Pakistan -- lawyers and the media-persons -- the enthusiasm of the common people for this seems to be minimal. But possibly there is a larger section cutting across the entire social fabric that fears that the notions of civil society may weaken Pakistan by movement away from Islam. They are more comfortable with the Sharia than with the modern notions of civil society.

The third element of the makeover is a vision of an understanding with India that would reduce avoidable unproductive expenditure on armed forces, and assist both countries in finding a mutually acceptable solution to problems that divide them, starting with Kashmir.

There may be some commitment to democracy in Pakistan, and at least some curiosity about the civil society, but such is not the case with the movement away from confrontation with India. President Musharraf, in his address to Pakistan on August 14, harped upon Kashmir in his effort to retrieve his lost popularity. It is a remedy that invariably gives relief to those in Pakistan who are in their political death throes. India-bashing is the prime expression of Pakistani patriotism.

Anyone who fails to blame and condemn India is likely to lose his credibility, and his ideas are likely to be rendered unacceptable on that count alone. Gilani during his visit to Washington actually did say that he would try to resolve disputes with India, including Kashmir, in a peaceful manner. That could not have endeared him either to the Pakistan army [Images] or to the ISI.

President Zia-ul Haq laid the foundation of Islamising the Pakistan army in the 1980s. A fair number of all ranks in the army have been Islamised since then, though not all of them visibly so. They have been working in the ISI, and through it, with the Islamists. The ISI has its officers predominantly drawn from the army. There are some from the police, and, of course, it has a permanent civilian cadre. But the command is with a serving lieutenant general of the army. It is this ability to control the leadership of the ISI that gave to the Pakistan army unparalleled power to pry into the affairs of the politicians, to raise funds and to manipulate elections.

When the need arose, it could effectively take over the governance of Pakistan. They could draw upon covert operatives and unaccounted funds at their disposal. The ISI before long got infected by the Islamist zeal and contacts. They hand-fed the Taliban [Images] and have been an interface between it and Al Qaeda [Images].

Unlike in the case of the Pakistan army, the permanent cadre of the ISI cannot be turned over at the whim and fancy of the army chief. Is the ISI acting with the concurrence of the army, or are they acting on their own? What happened in the last week of July might not have been entirely to the liking of the army. The Pakistan army is unlikely to want to rock the boat at present and hopes to ride the storm.

The ISI, a State within the State, has no such inhibitions or accountability; and it also has enormous resources at its command. It has complete dossiers and lowdown on all senior army officers, bureaucrats, politicians, professionals, and other opinion makers. It can operate many levers of power including the terrorist organisations on call. Its controllers, namely the Pakistan army, have mechanisms to control the ISI, but by now the ISI might have developed a life of its own. It could well follow its own agenda, with or without the knowledge of the army provided it feels that it enjoys public support for its Islamist agenda.

It is the ISI which has been inspiring and supporting terrorist operations against India. The fiction of the 'Indian Mujahideen' [Images] who claimed responsibility for the blasts in Ahmedabad and Bengaluru in the last week of July appears to be its handiwork. There are, of course, local hosts and operatives in India, but the vision, the strategy, the plans, the command and control elements, the training and motivation, and the logistics could only have come from the ISI or its franchisee in Bangladesh.

These happenings in the last week of July point to the implementation of Islamist and anti-India agenda that could not have been undertaken either by the newly elected government of Pakistan, or even by the Pakistan army at present. The needle of suspicion points to the ISI.

The covert supporters of Islamist ideology and terrorists may well span a vast spectrum starting from professionals, to the bureaucracy, to the business and industry, to government departments, to some officers and others in the Pakistan army. The overt supporters and the action group may cover the entire range of terrorist organisations all over the sub-continent including the Taliban, and Al Qaeda operatives. It is highly unlikely that the ISI would act on its own without being sure that there are fault-lines that run across the Pakistan's polity and a considerable section of opinion makers in Pakistan support the Islamist agenda.

Contrary, to what we would like to believe, there may be an incipient vertical split amongst the power and stake holders in Pakistan. If so, the ISI would be the first to notice and exploit it by backing the Islamists with or without the knowledge and concurrence of the army. It is quite likely that the disenchanted elements in the ISI, or all of it, brought grave embarrassment to the Pakistan prime minister because he was acting against the will of the Islamists in Pakistan.

What has been on view since the bombing of the Indian embassy at Kabul -- the embarrassment of Gilani et al -- is consistent with some or most elements of the ISI turning into 'rogues'. These considerations concern us more in India rather than the ouster of President Musharraf or the state of democracy in Pakistan.

Hopefully, the rogues in Pakistan will not succeed. Otherwise, Pakistan may go the Afghan way which bodes ill for India.

Lieutenant General Ashok Joshi (retired) is a former Director General of Military Training, Indian Army [Images].