Leading Article: There must now be no return to military rule

The Pakistani general elections have had a more positive outcome than many inside and outside the country dared to hope. With most of the votes counted in the world's sixth most populous country, the opposition parties have registered a sweeping victory. President Musharraf's coalition of supportive parties performed atrociously, despite a campaign of intimidating rival supporters and attempted vote-rigging.

Meanwhile, the two biggest parties to emerge from the vote, Nawaz Sharif's Muslim League and the People's Party of the late Benazir Bhutto, are ready to do a deal, which would give them control of a majority in Parliament. The new government will have a strong democratic mandate.

This could be ominous for President Musharraf. Neither party is his friend. It was Mr Musharraf's coup nine years ago that ended the premiership of Mr Sharif. And Ms Bhutto's widower and interim leader of the People's Party, Asif Zardari, has all but accused Mr Musharraf of being involved in her assassination. If the two parties were able to muster a two-thirds majority in Parliament, they could call for the president's impeachment. But impeachment is not easily achieved and would be constitutionally messy. Mr Musharraf is under no obligation to resign, and is now making conciliatory noises, claiming he wants to work with any new government. If he means it, this could, paradoxically, be the best outcome.

Mr Musharraf's rule hitherto has been little short of a disaster for Pakistan. For all his notional support for the United States and its "war on terror", Islamist militancy has grown, some say with the tacit support of the state intelligence services. The western tribal regions have provided a cross-border safe haven for the Taliban, which has helped to destabilise neighbouring Afghanistan. Meanwhile, all Mr Musharraf's lavish spending on the military has left little for education. The result has been the growth of the madrassas, many of which are run by militant preachers and little more than factories for brain-watching.

It is true that not all of Pakistan's maladies can be blamed on Mr Musharraf. It is also true that the president himself has been a prominent target of the militants. And any government would have struggled to impose order on the tribal regions and police the border with Afghanistan. But he cannot escape responsibility for the retreat from democracy during his period in office. He has wantonly undermined the independence of the judiciary by sacking members of the Supreme Court. And his decision to place civil rights activists and opposition leaders under house arrest last year also exposed the hollowness of his democratic credentials.

Politically, President Musharraf now looks to be a spent force. With both his rivals prepared to countenance power-sharing only if the role of president is reduced to little more than a figurehead, this could be an opportunity for Pakistan to develop a system of proper checks and balances.

All this assumes, of course, that another ambitious army general does not exploit Mr Musharraf's weakness to mount a military challenge to his rule – and that no foreign government would repeat the mistake of backing another "strongman". What Pakistan requires is a return to the rule of law and multi-party democracy. If the past decade in Pakistan has taught anything, it is that dictatorship does not stifle extremism, but nourishes it. Military rule provides only an illusion of stability. It is in all our interests that it does not return to Pakistan.