Pakistan's troubles start to stack up ominously
Guest columnist Ahmed Rashid says that in the midst of devastating floods, two insurgencies, a visible economic collapse and a growing row with the US, Pakistan is suffering from yet another self-inflicted wound, with a major political crisis brewing that could yet see the government toppled.
For the third time in two years, the army appears to have lined up with Supreme Court Chief Justice Iftikhar Muhammad Chaudhry to try and legally disqualify Prime Minister Yousuf Raza Gilani and President Asif Ali Zardari, and force them to resign.
It would be a constitutional rather than a military coup, so that Western donors helping Pakistan with flood relief would not be unduly put off, but the army would gain even more influence if it were to happen.
A war of words has erupted between the chief justice on one side and the government on the other, with leading political opposition parties now throwing their weight behind the court.
The government has been paralysed by the crisis and become even more ineffective in dealing with the chaotic economic aftermath of the floods.
Several petitions have been filed in the Supreme Court that have resurrected various charges of alleged corruption against President Zardari and Prime Minister Gilani, accusing them of contempt of court for not carrying out the court's orders.
In recent years, two earlier attempts to unseat the president through the courts were smoothed over behind the scenes and by international diplomatic efforts.
The court has now given the government until mid-October to accept its demands and mend its ways.
In a tense three-way meeting on 27 July, army chief General Ashfaq Pervez Kayani is reported to have warned Mr Gilani and President Zardari that they had to to carry out a drastic reshuffle of the cabinet, end corruption and carry out tough reforms of the economy.
The government has come in for enormous criticism for its incompetence in the wake of the floods which, since July, have affected 20 million people and left two million homeless.
The government has declined to carry out a cabinet reshuffle, root out corruption, set up civilian task forces to carry out flood relief or create transparent mechanisms for dispersing Pakistani and Western aid for the floods despite overwhelming public demand.
More than 80% of Western aid has gone to the UN and private aid agencies rather than the government because of the lack of trust.
The US, Britain, Japan, the World Bank and even the usually non-combative UN Secretary General Ban Ki-Moon have publicly warned the government that its efforts to demonstrate transparency when receiving flood relief money are not good enough, and that it also must raise money itself through new taxes - which the government is reluctant to do.
Pakistan has a terrible dilemma.
If the government goes or stays, either way Western donors' reservations about aiding Pakistan in its economic crisis will continue.
This is not helped by rising tensions between Islamabad and the US because of helicopter and drone strikes inside Pakistan - one of which recently killed three Pakistani soldiers - and Islamabad's retaliatory closing down of its border to Nato goods entering Afghanistan.
Moreover, Europe is on red alert after reports that a major terrorist attack hatched by al-Qaeda and the Taliban from Pakistan's tribal areas might hit several European countries simultaneously.
Pakistani intelligence denies such a plot even exists.
President Zardari has had a long running battle with Justice Chaudry since 2008.
Nevertheless the real threat comes from the army, which privately says it is fed up and frustrated with the government.
In July Mr Gilani gave Gen Kiyani a three-year extension in a bid to gain his support.
Instead both he and General Shuja Ahmed Pasha, head of the all powerful Inter-Services Intelligence Intelligence, have acted more and more independently of the government.
Blowing hot and cold
The army is already in a very powerful position after President Zardari conceded major powers to it.
It dictates the government's foreign and national security policy, and has stymied attempts by the civilian government to improve relations with India or clamp down on the Lashkar-e-Toiba, the most powerful militant group in the country that allegedly carried out the Mumbai attacks of 2008 in which 174 people were killed.
Western diplomats are also frustrated with the army, accusing it of playing multiple games with the US administration, Nato and Afghan President President Hamid Karzai.
Critics say the army is blowing hot and cold about trying to bring Afghan Taliban leaders - who all have sanctuaries in Pakistan - to the negotiating table.
President Zardari has made personal efforts to improve Pakistan's relations with President Karzai, but the army calls the shots on Afghan policy.
The army has also been assertive recently on the domestic front.
For the first time it established its own flood relief fund for private donations and snubbed the prime minister's relief fund, which it usually supports in such emergencies.
The army has received large private donations, because it is doing much of the heavy lifting for the flood relief work.
Moreover, from documents presented to the International Monetary Fund it appears that Pakistan has increased its defence budget by $1.28bn, taking defence spending to $6.41bn in the 2010-11 budget.
The army appears to have got this extra money without formal approval or discussion by the cabinet or parliament.
The increase comes as the cash-strapped government has been forced to drastically reduce the budgets for development, education and health.
Through the local media the army is also determined to show that it is standing up to the Americans, while the government appears vacillating.
The government now has a few days before the next hearing of the Supreme Court to carry out some meaningful changes at the top and show more resolve in curbing its bad practices.
However, it is still uncertain as to what it will do.
The risks involved if Mr Gilani is indicted by the Supreme Court but refuses to resign, regional concerns about a new military-dominated civilian government coming to power, worsening relations with Washington, the threat of social unrest and huge spikes in inflation and joblessness all point to a state that is perilously close to further chaos.
Elections are not due until 2013 but the government in a bid to stave off greater opposition may agree to call them a year earlier.
But the government still needs to improve its performance.
All stakeholders need to take a deep breath and step back from the brink, let the political temperature cool and perform their allotted functions.
Ahmed Rashid's book, Taliban, has just been updated and reissued on the 10th anniversary of its publication. His latest book is Descent into Chaos - The US and the Disaster in Pakistan, Afghanistan and Central Asia.