Pakistan's increasingly assertive Supreme Court has declared Prime Minister Yusuf Raza Gilani ineligible for office, plunging the country into fresh turmoil as it deals with Islamic militancy, a weak economy and a crisis in relations with the United States.
However, there seems to be no immediate threat to the stability of the government since the ruling Pakistan People's Party (PPP) has a comfortable majority in parliament.
But the move is bound to sharply raise tensions between the unpopular civilian government and Supreme Court Justice Iftikhar Chaudhry, who has made a name for himself in recent years by taking on Pakistan's most powerful figures.
In April, the Supreme Court found Gilani guilty of contempt of court for refusing to reopen corruption cases against President Asif Ali Zardari.
"Yusuf Raza Gilani stands disqualified as a member of the Majlis-e-Shoora (parliament)," said Chaudhry in a packed courtroom. "He has also ceased to be the prime minister of Pakistan ... the office of the prime minister stands vacant."
Fawad Chaudhry, a senior Gilani aide, said only parliament could dismiss the prime minister, a view shared by analysts.
However, within hours of the Supreme Court decision, state television reported that the Election Commission of Pakistan had issued the official notification of Gilani's disqualification. The ruling can be challenged.
While the decision is a big blow to the PPP, it is unlikely to lead to the fall of the unpopular government.
The US State Department described the court decision as an internal affair, but said it expected discussions with Pakistan aimed at repairing deeply strained ties would continue.
The PPP and its coalition partners have the numbers in parliament to elect a new prime minister until the government's term ends early next year when a general election is due.
"I don't see this as a major constitutional breakdown unless the PPP ignores this decision," said legal expert Salman Raja.
"I think sanity will prevail and they should be able to do that (replace Gilani) fairly easily given that they just passed the budget - they clearly have a majority (in parliament)."
The PPP's central executive committee said it would set aside reservations it has on the judgment, consult with legal advisers and then formulate a strategy. The party urged its workers to exercise restraint.
"Once we have finished our consultations, parliament is the forum for this. We will see what route we have to take," senior PPP official Qamar Zaman Kaira told reporters. Zardari cancelled a visit to Russia over the Supreme Court judgment, a presidential spokesman said.
Gilani is the first serving prime minister in Pakistan's history to be convicted by a court.
Thousands of corruption cases were thrown out in 2007 by an amnesty law passed under former military president Pervez Musharraf, paving the way for a return to civilian rule.
Two years later, the Supreme Court ruled that agreement illegal and ordered the re-opening of money laundering cases against Zardari that involved Swiss bank accounts.
Gilani and his government refused to obey the court's order to write to Swiss authorities asking them to re-open money laundering cases against Zardari, arguing that Zardari had immunity as the head of state.
PUBLIC ANGER OVER GOVERNMENT FAILURES
Political upheaval often distracts Pakistan's leaders from a dizzying array of problems, from widespread poverty to a struggling economy.
In the last few days, Pakistanis furious over power cuts that can last up to 18 hours a day in some areas have burned tyres in the streets and thrown rocks at buildings.
On Tuesday, guards shot at protesters who were trying to force their way into a politician's house in the central Pakistani town of Kamalia. Two of them died of their wounds.
But the headlines in Pakistan are often grabbed by the central characters in the country's major institutions - the government, the judiciary and the powerful military.
Chaudhry's supporters see him as a survivor determined to fight injustice. Detractors say he pushes too far, creating a conflict between the judiciary and political leaders that threatens Pakistan's young democracy.
Gilani's fate could also distract the government from engaging with US efforts to improve heavily damaged ties with Pakistan. Washington is trying to persuade Islamabad to re-open supply routes to NATO forces in Afghanistan that were closed last year in protest against a NATO cross-border strike that killed two dozen Pakistani soldiers.
The attack came after ties between the United States and Pakistan had deteriorated over the unilateral US special forces raid that killed Osama bin Laden on Pakistani soil last year. That operation humiliated Pakistan's military.
Islamabad is seen as critical to US efforts to pacify Afghanistan after more than a decade of war against the Taliban.
But it is often described as an unreliable ally because of its alleged support for Islamist militant groups, poor governance, frequent power struggles involving the judiciary, civilian leaders and the military, and widespread corruption.
In Washington, the US State Department stressed that it expected talks on the land supply routes to continue.
"The question of Prime Minister Gilani's status and future, and the court process with regard to him, has been going on for some time. We have nonetheless been able to work with the Pakistan government through that period," State Department spokeswoman Victoria Nuland told a news briefing.
"Our hope and expectation is that we will continue to be able to work with the Pakistanis to try to finish some of these issues that we need to finish."
CHAUDHRY BACK IN SPOTLIGHT
The Supreme Court decision also puts Chaudhry back at the centre of Pakistan's turbulent political stage.
Chaudhry became a household name in Pakistan and gained international recognition in 2007 when he stood up to then President Musharraf over his legally questionable bid to hold on to power.
Since then, he has taken on the government over allegations of corruption, and has even challenged the military, which has ruled for more than half of Pakistan's 64-year history.
Chaudhry took up cases involving kidnappings and torture of suspected Islamist militants allegedly carried out by the military and intelligence agencies. They deny the charges.
"The Supreme Court has expanded its domain once again," said analyst Hasan Askari Rizvi.
"The Supreme Court does not have the power to dismiss the prime minister, only the parliament does. It's the first time in Pakistan's history that the Supreme Court has removed a prime minister and it has created a precedent."
The move comes during a difficult time for the chief justice.
A Pakistani real estate tycoon on Tuesday accused Chaudhry of turning a blind eye to his son's alleged corrupt financial practices.