Riot police sealed off Pakistan's capital with barbed wire and shipping containers on the eve of Independence Day, in a bid to foil mass protests aimed at toppling embattled Prime Minister Nawaz Sharif.
Two groups, led by cricket star-turned-opposition politician Imran Khan and cleric Tahir ul-Qadri, plan to converge on Islamabad on Thursday to press Sharif to call an early election little over a year after his landslide victory at the polls.
Police said on Wednesday they had detained 2,100 followers of the two figures in the past few days and it was uncertain how many protesters would reach the city. A late night court ruling, however, implied Khan's march might be allowed to go ahead.
The latest challenge to Pakistan's fragile democracy will sow unease among neighbours and allies. The nuclear-armed state, which is battling an internal Islamist insurgency and home to virulently anti-Western and anti-Indian militant groups.
How far Khan and Qadri succeed in destabilising the government could ultimately depend on the stance taken by a military with a long history of mounting coups.
The protesters style themselves as crusaders against corruption and say last year's election was fraudulent. Sharif's loyalists accuse them of being a front for darker, anti-democratic forces.
While the political temperature has become more feverish, Pakistan's generals have stayed silent. Exchanges of fire between Pakistani and Indian forces on the disputed border in the contested Kashmir region have added to the tension.
Many analysts doubt whether the military wants to seize power, but there is a widespread perception it could use the opportunity to put the civilian government under its thumb.
"The idea was to put pressure on our government and it has worked," a cabinet minister told Reuters, requesting anonymity. "Once this is over, things will be a lot more difficult for the government. The decision-making space will be reduced. It is unfortunate that anti-democratic forces have pushed things to this point."
Speaking to journalists in Lahore on Monday, Information Minister Pervais Rashid was more direct, accusing a former "spymaster" of coordinating the security for Khan's protest. Pakistani media identified him as Ahmed Shuja Pasha, who retired as head of the military's feared Inter-Services Intelligence (ISI) Directorate two years ago.
Neither Pasha or Khan were available for comment.
Since returning to power, Sharif has been at odds with generals who seemed happy to let civilians run Pakistan's rickety economy but jealously guard their dominant influence over internal security, defence and foreign affairs.
Relations with the military soured when Sharif's government prosecuted Musharraf last year for treason, angering officers who see the army as Pakistan's saviour and despise politicians like Sharif as corrupt.
Recently Sharif has relented. Musharraf's prosecution ground to a halt and he was released from house arrest, but he remains unable to leave the country.
For all the conspiracy theories, Sharif's loyalists have avoided spreading suspicion over serving generals, and the government last month entrusted security in the capital to the military.
"There may be individuals involved in this (protest), friends of Musharraf, perhaps. But we don't see any evidence that the army as an institution is involved," said Ahsan Iqbal, the secretary-general of Sharif's party.
Both Khan and Qadri have repeatedly denied having secret military support. "I am not saying call in the army," Khan said in a televised speech on Monday. "The army is not the solution."
The military repeatedly says it does not meddle in politics.
So far the government's response to the protests has been a mixture of carrots for Khan and sticks for Qadri.
Late on Wednesday night, a court ruled Khan's march might be permitted if it was "constitutional". Insiders said the vague ruling meant Khan might be allowed to lead his march to the capital if he dropped calls for Sharif to resign.
Qadri, who controls a network of religious schools and charities, has met stiff opposition since his supporters clashed with police in June and last week. His home in Lahore has been blockaded with shipping containers.
His planned protest in the eastern city of Lahore on Sunday was thwarted by mass arrests of his followers.