Updated

The Supreme Court convicted Pakistan's prime minister of contempt on Thursday but spared him a prison term for refusing to reopen a corruption case against his boss, the president -- a verdict that means the premier could limp on in office for months to come, possibly until elections.

But the ruling against Prime Minister Yousuf Raza Gilani will add to pressure on him to resign, including from members of his own party, and trigger continued political uncertainty, effectively crippling an administration that has shown little will to tackle the economic and security challenges facing the country.

Thursday's hearing had been widely anticipated by opponents of Gilani and President Asif Ali Zardari, who were hoping the Supreme Court would sentence the prime minister to prison and order his immediate dismissal from office. That would have triggered a major political crisis, and could have benefited Gilani and Zardari electorally, making them martyrs in the eyes of their supporters.

Gilani is the longest-serving prime minister in the history of Pakistan, where civilian governments have repeatedly been toppled by the country's powerful military, often with the support of the Supreme Court, which critics allege is heavily politicized. Corruption charges have routinely been used to target those in power, or seeking to return.

The verdict effectively prolongs the current crisis, however. Gilani's conviction in a court of law means there are now grounds to initiate dismissal proceedings, a process that could take up to four months and be fiercely contested every step of the way.

His lawyer said Gilani would appeal, further delaying any action against him in a case that has its roots in a Supreme Court decision in 2009. It picked up pace in January this year, when the court ordered contempt proceedings against the prime minister.

Elections are scheduled for later this year or early next, meaning the government could see out its term with Gilani still in charge. That is a feat in itself in a country with a history of repeated coups and judicial machinations against elected governments.

Gilani arrived at the court house flanked by ministers and in a shower of rose petals tossed by supporters.

The ruling said that Gilani was guilty of contempt, but would serve a sentence only "until the rising of the court," or by the time the judges left the chamber. That happened about three minutes after the verdict was handed down.

Outside, government loyalists fumed at the court ruling, foreshadowing more bitter conflict between the government and the judiciary.

"With utmost respect, I have to say this court order is absolutely illegal," said Attorney General Arfan Qadir. "This order is to be ignored," he said.

Political analysts said that the government, which relies on the support of coalition parties to stay in office, may now pressure Gilani to step down since he is a convict in the eyes of he law. If he were to resign, they said Zadari could likely get the support in parliament to elect a new prime minister.

"It's a political decision now," said Cyril Almedia, a political commentator. "Is the damage they sustain having Gilani continue in office less than the benefits of having a martyr at the helm."

The source of the current conflict is a graft case against President Asif Ali Zardari that involves kickbacks he and his late wife, former Prime Minister Benazir Bhutto, allegedly received from Swiss companies when Bhutto was in power in the 1990s. They were found guilty in absentia in a Swiss court in 2003.

Zardari appealed, but Swiss prosecutors ended up dropping the case in 2008 after the Pakistani government approved an ordinance giving the president and others immunity from old corruption cases that many agreed were politically motivated.

The Pakistani Supreme Court ruled the ordinance unconstitutional in 2009 and ordered the government to write a letter to Swiss authorities requesting they reopen the case against Zardari. Gilani has refused, saying the Pakistani constitution grants the president immunity from criminal prosecution while in office.

It is far from clear whether Swiss authorities would pay any attention to such a letter. A Swiss prosecutor said last year that Zardari had immunity, and there are also statute of limitations issues. The refusal by the government to send the "Swiss letter" is in large part political. It doesn't want to be seen initiating a graft case against Zardari, especially one that involves his ex-wife, Bhutto.

Government loyalists have acccused the chief of the Supreme Court of having a feud against Zardari. Supporters of the judiciary say it is trying to uphold the law in a country where the country's politicians have engaged in massive corruption for years.