A Pakistani cleric late Thursday called off a mass protest in Islamabad, averting a major political crisis and reaching a deal with the government that paves the way for elections within months.
The decision, hours after the Supreme Court adjourned an alleged corruption case against Prime Minister Raja Pervez Ashraf having earlier ordered his arrest, gives the government breathing space after three days of high tensions.
Pakistan has been weakened by a poor economy, resurgent Taliban violence, record sectarian unrest, a dire energy crisis and even fledgling peace gains with India have appeared in jeopardy following five recent cross-border killings.
Tension had been at fever pitch since Tuesday, when the court ordered Ashraf's arrest and cleric Tahir-ul Qadri arrived in Islamabad with tens of thousands of supporters, denouncing politicians and praising the armed forces and judiciary.
The timing sparked panic about a rumoured judiciary-military plot to derail elections due by mid-May. The polls, if on schedule, would be the first democratic transition between two civilian governments in Pakistan's history.
There were few signs of any significant government concessions in the deal reached on Thursday, which stated that parliament would be dissolved at any time before March 16 so that elections can take place within 90 days.
The government had previously said parliament would dissolve on March 17.
But Qadri hailed it as victory for the protesters, estimated to number around 25,000 in the largest ever demonstration in the capital since the current government took office in 2008.
"I congratulate you. Today is the day of victory for the people of Pakistan. You should go home as peacefully as you came here," Qadri told participants after signing the deal with the prime minister.
Qadri's supporters danced and cheered in a carnival-style atmosphere despite the chilly winter night, before packing their bags, collecting up mattresses and blankets, and getting in their vehicles to leave, an AFP reporter said.
"I am very happy. I can't explain it. We felt the cold very badly in the last few days but we're happy that we've been successful in our mission and we want rights for the next generation," said 26-year-old housewife Muqaddas Zulfiqar, holding her two-year-old son.
"If we had to stay here longer, we would have stayed."
Qadri, cabinet ministers and members of the coalition negotiated for hours in the bullet-proof container where the cleric has been holed up since early Tuesday while his supporters have slept on the ground outside.
"I congratulate you. Today this is another victory for democracy," Information Minister Qamar Zaman Kaira told the crowd, standing alongside Qadri.
"This is your victory. This is Qadri's victory. This is my victory and this is the people's victory. This is the real face of Pakistan," he added.
Qadri had called for parliament to be dissolved immediately and for a caretaker government to be set up in consultation with the military and judiciary to implement reforms before elections.
His sudden -- and apparently well-financed -- emergence after years living in Canada has been criticised as a ploy by sections of the establishment, particularly the armed forces, to delay the elections and regain power.
Chief Justice Iftikhar Muhammad Chaudhry adjourned until January 23 the case being heard against Ashraf and 15 others accused of corruption over power projects that date back to his time as water and energy minister.
Chairman of the National Accountability Bureau Fasih Bokhari said it would take time to find evidence to prosecute anyone despite the court ordering in March 2012 legal proceedings against Ashraf.
Political analyst Hasan Askari warned that it was only a temporary reprieve.
"Even if they come up with a solution to the present problems, they may get another crisis... So the government should announce elections now," he said.