ISLAMABAD (AP) -- Pakistan's top court dismissed the prime minister from office on Tuesday for failing to investigate the president for corruption, ushering in a new round of political turmoil in a nation vital to American hopes of withdrawing from neighboring Afghanistan.
The Supreme Court ruling against Yousuf Raza Gilani was unlikely to topple the fragile, coalition government. But it left it weakened and without a Cabinet. Most analysts expected the government to heed the court order and begin the process of replacing Gilani, or possibly expedite general elections that must be held before early next year.
The move was likened by some to a " judicial coup" in a country with a history of destabilizing conflicts between the courts, the army and elected governments. It comes as Pakistan faces near economic collapse, power shortages and its own struggle against Islamist militants behind attacks that have killed thousands of people over the last five years.
The prime minister has refused to step down since he was convicted of contempt of court in April for not asking authorities in Switzerland to reopen a 1990s graft case against his boss, President Asif Ali Zardari.
Zardari's Pakistan People's Party should have enough support in parliament to elect a replacement for Gilani, but at the likely cost of concessions to its coalition partners. As a coalition meeting broke up late Tuesday, some media reports said Makhdoom Shahabuddin, the textile minister, was emerging as a consensus candidate.
The ruling was a major escalation in a long-running confrontation between the judges and the government. Supporters of the government, and some independent commentators, accuse the court of pursuing a vendetta against Zardari that threatens the country's nascent democracy. Zardari's critics, on the other hand, say the court is the only institution standing up against the rampant graft -- and ineptitude -- in his administration.
One possibility was that Gilani and Zardari might try to defy the court order. That could spark institutional deadlock and social unrest. It even raises the possibility of the army staging a coup, as it has done three times in the country's history, or being asked by the court to implement its order.
Yasin Azad, president of the Supreme Court Bar Association, said Gilani had the right to file a "review petition" against the ruling within 30 days, but that it would have little chance of success. Gilani would remain disqualified from office so long as the review was being heard.
The political chaos coincides with a near breakdown in relations between the United States and Pakistan, whose ties to the Afghan Taliban make it important in any negotiated settlement to the war. Pakistan is refusing to reopen NATO supply lines to Afghanistan it blocked in November to protest U.S. airstrikes that killed 24 Pakistani border troops.
The fresh turmoil may hamper any U.S. efforts to engage with Pakistan's leadership on the supply line issue in the coming days. But assuming a replacement prime minister is elected before too long, then it may not have much lasting impact.
The ruling was the culmination of a process that began in a Supreme Court decision in 2009 ordering the government to write a letter to authorities in Switzerland to reopen the cases against Zardari. Gilani refused, saying the president had immunity from prosecution so long as he was in office and that doing so would violate the constitution.
In January, the court ordered contempt proceedings against him. In April, judges found him guilty but didn't explicitly disqualify him. On Tuesday, judges removed any ambiguity. They ruled Gilani has not legally been the prime minister since the April conviction, and raised questions over whether government decisions since then remained in effect.
"The office of the prime minister shall be deemed to be vacant accordingly," said Chief Justice Iftikhar Chaudhry. He ordered Zardari to "ensure the continuation of the democratic process," apparently instructing the president to begin the process of electing a new prime minister.
Hours after the ruling, the country's election commission formally issued a notice saying Gilani had been dismissed.
Ahsan Iqbal, an opposition leader, praised the ruling and urged Zardari to nominate a new prime minister.
"Gilani stands disqualified," he said. "Now the president should convene the session of the parliament to elect a new prime minister."
The Zardari government has failed to make any headway in tackling any of the nuclear-armed nation's many problems.
As the ruling was read out, thousands of people were rioting in the nation's heartland of Punjab over rolling power cuts that have left many houses with electricity for just four hours a day. Police reported unrest in scores of towns for the third consecutive day, with officers firing tear gas against rock-throwing protesters, who torched scores of buildings, including one belonging to a lawmaker.
But the court order against Gilani could become an advantage to Zardari's party in elections. The partly will doubtlessly portray the case against Gilani as the latest in a long line of unjust decisions by the courts and the army, using it to fire up the party's base. Party founder Zulfikar Ali Bhutto was hanged by the court in 1979.
The ruling came as the Supreme Court itself was reeling under its own corruption scandal. Last week, a billionaire property tycoon with links to the army and the government alleged that he gave Chaudhry's son millions of dollars to influence court cases.
That scandal, which has weakened Chaudhry and the authority of his court, will now likely be overshadowed by the demise of the prime minister. By dismissing Gilani, the court took the hardest line possible against him. It could have directed the election commission to disqualify him, a process that would have taken 90 days, allowing the government to inch closer to the end of its five-year term. An elected government in Pakistan has never completed its full term in office.
Moeed Yusuf, South Asia adviser at United States Institute of Peace, said he thought the court had to act after staking its reputation on getting Gilani to write the so-called "Swiss letter." He thought the government would likely replace Gilani with an interim prime minister in the coming days.
But he predicted the new prime minister would also immediately find him or herself under pressure from the court to investigate Zardari.
"What you are really looking at is a judiciary-executive conflict that will worsen as the elections get closer," he said. "It is going to get pretty bad."
Associated Press writers Rebecca Santana, Munir Ahmed and Asif Shahzad contributed to this report from Islamabad.