Pakistan's Supreme Court ordered the arrest of the prime minister in connection with a corruption case linked to power projects, television channels reported on Tuesday, plunging the country into fresh political turmoil.
The move came as a populist cleric, who is believed to be backed by the military, demanded the resignation of the government in protests attended by thousands of followers in the heart of the capital Islamabad.
The Supreme Court gave authorities 24 hours to arrest Prime Minister Raja Pervez Ashraf and 16 others.
Pakistan's stock exchange fell by nearly three percent after news of the court order, highlighting anxiety over political uncertainty.
The cleric, Muhammad Tahirul Qadri, threatened to remain camped out near the federal parliament with thousands of supporters until his demands were met. Qadri recently returned home from Canada to lead a call for reforms that has made him an instant hit among Pakistanis disillusioned with the state.
It was not clear how much of a potent threat the two events posed for the US-backed civilian government, but the court order and the mass protest around the parliament complex are the latest in a series of challenges for the administration.
In a speech from behind a bulletproof shield in front of parliament, Qadri praised the military and the judiciary, the country's two other power centers.
"[The government] has wasted and brought a bad end to our armed forces, those armed forces who are highly sincere, highly competent and highly capable and highly professional," he said, alternating between Urdu and English.
"Even they can't do anything because the political government isn't able to deliver anything from this land. Judgments are being passed by our great, independent judiciary but the government is not ready to implement them."
A spokesman for the cleric said protesters would remain camped around parliament until the government dissolved the legislature and announced the formation of a caretaker government.
At one point, security forces fired in the air and used tear gas to try and control the crowd. Interior Minister Rehman Malik later told local television channels the government would not cave in to Qadri.
"We will not accept Qadri's pressure because his demands are unconstitutional," Malik said.
Qadri's campaign has divided Pakistanis. Some hold him up as a champion of reform, others see him as a possible stooge of the military, which has a history of coups and interfering in elections.
But he can mobilize thousands of members of his Minhaj-ul-Quran religious organization, which runs a network of schools and clinics and organizes relief for victims of natural disasters.
"He's spent huge money and he's putting his life on the line, he's here to redeem the people," said Mohammed Waqas Iqbal, a local government official who had travelled from a village in northern Punjab to attend the rally in Islamabad.
Like many of the protesters, Iqbal is an active member of Qadri's organization, attending daily prayers at a mosque it runs in his village.
Qadri, who holds a doctorate in Islamic law, has impressed his followers with his readiness to leave a comfortable life in Canada to brave the potential security threats associated with participating in Pakistani politics.
"He's an honest man, that's why we believe in him," said Waqas Ali, a garment wholesaler from the eastern city of Lahore, who said he had spent his own money to fund the journey to Islamabad, and was sleeping on the streets.
Qadri also appeared to have found some supporters who are not members of his religious movement but who hope he may be able to tackle the corruption, economic stagnation and chronic power crisis that have festered under the government of President Asif Ali Zardari.
"Dr Qadri could have stayed in Canada with a luxurious lifestyle, but he came to Pakistan to fight for the people," said Hassan Khan, a bus conductor.
"If I run out of money I am willing to sell my blood for this struggle."
Pakistan's established political parties fear the military is backing Qadri's movement in the hope it will trigger a crisis that will provide a new opportunity for the army to meddle in politics ahead of elections due to take place this spring.
The government and opposition are poised to start negotiating the formation of a caretaker administration to oversee the run-up to the polls as soon as parliament is dissolved, which is due to happen in March. An election date has yet to be announced.
Qadri's platform hinges on a demand that the judiciary bars corrupt politicians from running for office and that the army plays a possible role in the formation of the caretaker government.
One senior military officer, who said he was speaking in a purely personal capacity, said there was no appetite in the military to repeat the coups seen in Pakistan's past, but added the stand-off could be resolved if the army played a role as a "moderator."
"We should try as far as possible to abide by the constitution and law in looking for change. The army chief has made this clear," the officer said.
"But things seem to be moving beyond control," the officer added. "It is totally incorrect to say the army is behind Qadri. But if he brings thousands of people to the streets and things get worse, there may be very few options."
The rally began on Monday and many of the protesters had stayed on the streets overnight. The spokesman for Qadri said his supporters had prevented government forces from arresting him.
Besides the protest, the government is battling several other challenges.
Tens of thousands of Shia Muslims, a minority in Pakistan, began burying the victims of a sectarian attack in a mass grave on Monday, ending an extraordinary three-day protest over one of the worst such attacks in the country's history.
People from the Shia Hazara community had been holding a vigil next to the bodies of the 96 people killed in Thursday's bombings in the city of Quetta to demand better protection from a rising tide of such attacks.
The Shia leaders only agreed to hold the burials after Prime Minister Raja Pervez Ashraf travelled to the provincial capital and agreed to some of their demands.
The government is also struggling to control Taliban insurgents based near the border with Afghanistan. Six paramilitary soldiers were killed in a gun battle with militants in northwest Pakistan overnight, military officials said.