Pakistani Prime Minister Yousuf Raza Gilani waves upon his arrival at the Supreme Court for a hearing in Islamabad, Pakistan on April 26, 2012. Pakistan's top court declared on June 19 that the country's prime minister was disqualified from office due to an earlier contempt conviction. (B.K. Bangash/AP)

A decision by Pakistan’s Supreme Court to dismiss Prime Minister Yousuf Raza Gilani for contempt on Tuesday threw the country’s political system into turmoil, creating fresh uncertainty about who will lead a nation that is central to U.S. efforts to end the war in Afghanistan.

The court’s decision set off a furious round of political speculation and sent Gilani and his supporters into emergency sessions to debate how to respond. The news initially prompted fears of street violence or an intervention by the powerful military if Gilani chose to fight for his post. But by day’s end, members of the ruling party seemed set to accept the verdict and turned their attention to finding Gilani’s successor.

The prospect of government upheaval in Pakistan threatens to complicate U.S. goals in neighboring Afghanistan. For months, Pakistan has blocked NATO supplies from passing through its territory into Afghanistan. Pakistan’s domestic troubles could distract attention from the Obama administration’s attempts to negotiate a reopening of the border and to earn greater Pakistani cooperation in negotiating with the Taliban.

The fragile Pakistani government faces serious economic woes and violent protests against electricity shortages. The country was already due for elections next year in which the ruling Pakistan People’s Party will have to defend its record since taking power from military strongman Pervez Musharraf in 2008.

Although there was no official word from Pakistani President Asif Ali Zardari as of late Tuesday, senior party leaders indicated that they would accept the court’s decision and allow Zardari to name a new prime minister and cabinet. That apparent acquiescence somewhat defused the prospect of an imminent confrontation.

Qamar Zaman Kaira, the information minister, said the court’s ruling meant that “the prime minister is no more the prime minister.”

“The PPP leadership has directed its workers not to resort to demonstrations and protest against this decision as we don’t want chaos in the country,” Kaira said.

But he added that the party has reservations about the verdict and that Zardari has the authority to decide how to proceed.

The court’s decision called for the election commission to formally strip Gilani of his post, which the commission did Tuesday. In April, the court had convicted Gilani of contempt after he refused its demand to reopen an old corruption case against Zardari. By dismissing the premier, the court also effectively dissolved his cabinet. If a new prime minister is chosen, the same cabinet members could resume their posts, but they would have to take a new oath of office.

The ruling came as thousands of people were out in the streets in Punjab, Pakistan’s most populous province, to protest the government’s rationing of electricity. Police used tear gas against the crowds as demonstrators set fire to buildings. But people did not appear to be rallying in support of Gilani.

Opposition figures were quick to hail the court’s decision, calling it a victory for the rule of law. One of them, Ahsan Iqbal, said it showed that “all people are equal in the eyes of the law.”

“I don’t see any threat to democracy after this decision,” Shah Mahmood Qureshi, a former foreign minister, said on Pakistani television. The government could appoint a new prime minister or hold quick elections, he said, “so we see the democratic process is on the move.”

With the premier and the cabinet effectively dismissed, the court’s ruling called into question whether the decisions made by the government since April 26, when Gilani was convicted, remain valid.

“There was talk within the party about his corruption and incompetence, and this opinion, I think, has prevailed, and someone else from the party would be nominated as prime minister,” said Rasul Bakhsh Rais, a political analyst. “This decision to have a new prime minister would give some time to the ruling party to chalk out a plan for the next elections and overcome the current political crisis.”

But whoever is picked to become the new prime minister, the Supreme Court would probably pressure that person to re-start the corruption probe against Zardari, said Hasan-Askari Rizvi, a political analyst.

“The future prime minister will now be in danger from two sides — the army as well as the judiciary,” Rizvi said.

Zardari and his wife, Benazir Bhutto, the former prime minister who was assassinated in 2007, were accused of using Swiss bank accounts to launder millions of dollars. The case was halted when Zardari became president in 2008, but the court demanded that Gilani write a letter to the Swiss authorities to reopen the case. Gilani refused, prompting the contempt-of-court conviction in April.

Partlow reported from Kabul.