A Muslim cleric with a history of ties to the military who has been calling for the Pakistani government to resign reached a deal with the administration on Thursday that will give him a say in the electoral process ahead of elections.
Muhammad Tahirul Qadri triggered a political crisis by launching mass protests in the capital four days ago calling for electoral reforms to clean up Pakistani politics.
He has been pushing for the military to play a role in the formation of the caretaker administration that takes over in the run-up to scheduled elections.
"We have reached an agreement," Qadri, who supported an army coup in 1999, told supporters camped out near parliament. "Allah granted us a victory and now you can go home."
Qadri persuaded the government to dissolve parliament before a scheduled date of March 16 so that elections, due in May, can take place within 90 days, and also to discuss electoral reforms, according to a copy of the agreement released by his spokesman.
A government source and officials in the ruling Pakistan People's Party said Qadri's demand that the army be consulted on the make-up of the interim administration had been rejected.
But it was agreed that the ruling coalition and his party must reach a "complete consensus" on the proposal of a caretaker prime minister.
Qadri's appearance at the forefront of Pakistan's political scene has fuelled speculation that the army, with its long history of involvement in politics, has tacitly endorsed his campaign in order to orchestrate a soft coup against a government it sees as ineffective. The military denies this.
"Qadri, unexpectedly, secured major concessions," said Shamila Chaudhry, an analyst specializing in South Asia at Eurasia Group.
The cleric, who has been delivering long, fiery speeches from behind a bullet-proof glass box because of his opposition to Taliban militants, has many followers who back his vast religious charity, which has offices in 80 countries.
But he also appeals to middle- and lower-class Pakistanis disillusioned with dynastic politics.
No civilian government has ever completed its full term, but current army chief General Ashfaq Kayani has vowed to keep the military, which has ruled Pakistan for more than half of its 65 years since independence, out of politics.
Critics of the military, however, say the generals still play a behind-the-scenes role to shape politics.
"The PPP was driven by its interest in making history - being the first civilian government to complete a full term. Technically, if the government dissolves before March 16, it hasn't achieved that goal," said Chaudhry.
"But the upside is that this situation remains constitutional and, as of now, it appears that a peaceful and democratic transition of power could still be in the cards."
The government has been heavily criticized for its failure to strengthen the economy, fight militancy and eradicate poverty, and the military regards the PPP as too inept and corrupt to keep the nuclear-armed country, a strategic ally of the United States, from falling apart.
The government got some relief earlier on Thursday when the chief of the state's anti-corruption agency rejected a Supreme Court order to arrest Prime Minister Raja Pervez Ashraf.
Ashraf is alleged to have been involved in kickbacks in transactions involving power plant rentals when he was power minister - allegations that he denies.
Fasih Bokhari of the National Accountability Bureau told the court that investigations of the allegations were incomplete.
The court asked Bokhari to produce case records so that it could decide whether there was enough evidence to prosecute. The case was adjourned until January 23, judges said.
But fresh trouble may be brewing on another front for the government.
The Supreme Court has admitted a petition filed against Sherry Rehman, Islamabad's ambassador to the United States and a prominent member of the PPP, that accuses her of committing blasphemy.
Court documents show that the police have been directed to investigate the allegations. Rehman has faced death threats from militants for calling for reforms of Pakistan's anti-blasphemy law, which has been condemned by human rights groups.