Pakistani Prime Minister Yousuf Raza Gilani, center, waves upon his arrival at the Supreme Court Thursday. The Supreme Court convicted Gilani of contempt for refusing to reopen an old corruption case against President Asif Ali Zardari. (B.K. Bangash/AP)

Pakistan’s Supreme Court on Thursday convicted Prime Minister Yousuf Raza Gilani of contempt for defying its orders to reopen an old corruption case against the president, but the justices spared Gilani any prison time.

The sentence was symbolic, lasting only until judges left the courtroom. But Gilani’s political future remains clouded by the possibility that he could still be removed from office.

For months, the political crisis had distracted from U.S. efforts to restore full diplomatic ties with Pakistan, which were badly strained after American warplanes inadvertently bombed two border outposts in November, killing 24 Pakistani soldiers.

The continuation of Gilani and his party in power, at least for now, provides a measure of stability that experts say should help speed the resumption of a cooperative, if uneasy, relationship between the two counterterrorism allies. Pakistan’s Parliament has indirectly granted the United States’ chief request: that Pakistan reopen its border to NATO convoys, including thousands of oil tankers, that supply troops in Afghanistan.

Gilani could have been sentenced to up to six months in prison, but his ruling Pakistan People’s Party was hardly pleased with the outcome. “This is a dark day in the history of the country,” Firdous Ashiq Awan, a former information minister, told journalists outside the court.

Analysts were divided over whether the conviction meant that the prime minister would have to give up his seat in Parliament, and thus his higher office. They said that could happen in a matter of weeks or months, depending on the outcome of legal wrangling.

Political score-settling here often includes new leaders bringing questionable criminal cases against members of parties that have fallen from power. Gilani’s conviction stemmed from his adamant refusal to pursue money-laundering and kickback cases brought by Swiss authorities against President Asif Ali Zardari.

Gilani has maintained that the constitution grants Zardari immunity from prosecution, and the president has denied the allegations, which date to the 1990s.

Although Gilani has served longer than any prime minister in the nation’s 64-year-old history, he also bears the stain of being the only prime minister found guilty of contempt; two others were charged but not convicted.

After his courtroom punishment, which lasted about 30 seconds, Gilani chaired a special cabinet meeting, in which he seemed sanguine about the entire matter. “Politics has lots of ups and downs,” he said, according to one cabinet member who was in the room and media reports.

A career in politics means unavoidable tumult, the embattled premier noted, offering an Urdu proverb: “Working with coal will make your hands black, too.”

Opposition leader Nawaz Sharif, who had faced contempt-of-court charges as prime minister in 1997, called on Gilani to quit.

“He should step down without causing further crisis,” Sharif said on the cable channel Geo News. He also called for elections.

Correspondent Shaiq Hussain contributed to this report.