By M Ilyas Khan
BBC News, Islamabad
The week-long stand off between the Pakistani security forces and armed militants holed up inside the Lal Masjid (Red Mosque) is being described by many observers as a double-edged sword for President Pervez Musharraf.
The siege has eclipsed some of Pakistan's more serious problems
The siege of the mosque in Islamabad has eclipsed more serious issues that have dogged the country in recent months, thereby diluting the ability of the opposition to capitalise on them more forcefully, they say.
But it is also likely to cause problems for the government itself in the coming weeks when the president will be required to make tough choices to survive in office.
Gen Musharraf, who took power in a bloodless coup in October 1999, wants to continue both as president and army chief for another five-year term.
Parliament made an exception to the law in 2004 - allowing him to hold both posts - but his term expires later this year.
The law requires that he wait for two years after retirement from the army to qualify for the office of a civilian president.
The conflict between the government and the Red Mosque clerics has been going on since February, and can be divided into two phases.
In the first phase, female students of a seminary in the mosque complex took over a public library by force and refused to vacate it until the government promised to rebuild some illegally constructed mosques that it had demolished.
From there, the female students and their male colleagues went on to impose their own version of Islamic justice in the city, raiding music stores and kidnapping women accused of prostitution, as well as a number of policemen.
The second phase began with the abduction of some Chinese nationals by the students last month.
Many analysts believe this was the tipping point when the government's earlier policy of appeasement towards them gave way to a siege of the mosque by troops.
Troops are blocking all entrances and roads to the mosque
This six-month long saga has been unfolding at a time when Gen Musharraf faces the most serious challenge to his eight-year rule.
He inadvertently sparked country-wide protests by lawyers when he suspended the country's chief justice for allegedly misusing his position on 9 March, weeks after the students captured the public library.
Since then, the Red Mosque conflict has been "waxing and waning with the lawyers' movement, and it is felt that every time the chief justice addressed a high-profile gathering, the Red Mosque students made a controversial move as if to grab rival space in the media", says Tanvir Ahmad Khan, a former diplomat and analyst.
Observers say these "coincidences" have tended to juxtapose an Islamist threat to Gen Musharraf, taken seriously in the West, with a gathering movement for democracy in the country.
The second phase began days after a cyclone hit Balochistan, a province which observers believe to be politically marginalised and where a low-intensity nationalist insurgency has been brewing since 2000.
Two weeks after the floods, people across large parts of the province still remain without any government relief in terms of water, food and shelter.
The provincial chief minister, Jam Yousuf, says the floods have caused damage costing people $1.35bn. He has asked the federal government to call for international aid, a request which the latter has turned down.
Analysts believe the government is reluctant to allow international aid groups into the area because this will expose the political and economic condition of the people of the province.
The government has rejected demands for foreign aid in Balochistan
"It will expose the actual extent of the military operation in Balochistan, and a non-responsive political set-up that is the product of rigged elections," says Afrasiab Khatak, an analyst and former head of the independent Human Rights Commission of Pakistan.
The Red Mosque conflict has also eclipsed an important gathering of opposition leaders in London, which comes at a time when Gen Musharraf is just days away from making a decision about whether he should quit as army chief.
A decision to this effect may translate into much needed support from some powerful political groups but will strip him of most of his powers, a prospect he is reluctant to accept.
Western, notably American, support has traditionally strengthened his bargaining position at home, and the Red Mosque conflict has eased some of the negative press that he was lately getting in the West.
But the Red Mosque conflict is expected to throw up some difficult questions which could haunt him on his campaign trail.
"After the conflict, the government has to explain why the intelligence apparatus failed to notice the presence of a large cache of arms and ammunition that enabled the militants to put up such a long fight in the heart of the country's capital," says Tanvir Ahmad Khan.
He points out that the mosque is located in the oldest and most central sector of Islamabad, among government offices, including the country's premier intelligence establishment.
The siege of the mosque is a direct challenge to the president
The mosque's leaders have a history of links to the intelligence establishment, he says, and have often been used to destabilise liberal and secular governments in the past.
"It will be difficult to convince a common citizen that the government did not know what was going on, or that it is wrong to suggest that the government plunged into action only when a structure that it had created for its own convenience got out of hand and resulted in the killing of so many people," he says.
The Supreme Court judgement in the chief justice's case is less than two weeks away, and whichever way it goes, Gen Musharraf will find treading the legal path from then on extremely narrow and tortuous.
Unless, say analysts, a string of militant attacks being seen as revenge for the mosque siege create a situation that prompts Gen Musharraf to impose an emergency.
That would enable him to suspend fundamental rights and put off elections by a year.