Yousaf Raza Gilani ordered to face supreme court to explain his failure to ask Swiss to reopen corruption cases against president

Pakistan's prime minister, Yousaf Raza Gilani, has been threatened with jail for contempt of court and ordered to appear before the supreme court in person, raising the possibility that he could be disqualified from office.

In the ongoing clash between the government and the courts, the judges went on the offensive on Monday, issuing a "show cause" notice for contempt of court to Gilani demanding he appear in court on Thursday.

Gilani told parliament he would appear in court "out of respect for the institution", but he is unlikely to comply with the order.

The ruling coalition managed to win what was a de facto vote of confidence in parliament late on Monday, but it failed to get the opposition on side.

The present government is battling the courts and the armed forces, both seemingly determined to end the tenure of the Pakistan People's party, while the political opposition is pressing for early elections.

The focus of the conflict with the judiciary is the legal immunity of the president, Asif Zardari, which the courts are challenging

"If there is no democracy, everything will end. If there's no democracy, we'll all be swept away together, not just some," Gilani warned parliament, in an emotive speech.

"We have to protect democracy. We have struggled for democracy and my leader gave her life for democracy."

The opposition walked out of parliament immediately after the vote. "The government wants to gain strength for its clash with other institutions from this vote. They wanted to strengthen prime minister Yousaf Raza Gilani's hand when he appears before the supreme court. They want to stand parliament against the supreme court," said Ahsan Iqbal, a senior member of the opposition Pakistan Muslim League-N.

Earlier in the day, in a private meeting of the coalition parties before the vote, Gilani reportedly roused them by comparing himself to the hero of the 1965 war movie Von Ryan's Express, played by Frank Sinatra, in which the star saves all his allies, but is himself shot and killed.

At issue with the supreme court are old allegations against Zardari of money laundering in Switzerland. The court has ordered the government to write a letter to the Swiss authorities to revive the case. The government has been resisting since 2009.

Because Gilani is the head of the government, it is ultimately his decision to send the letter to Switzerland. His refusal is seen by the court as an act of contempt. If he is convicted of contempt, or any other criminal offence, in theory he can no longer be a member of parliament and therefore, prime minister.

Many insiders in the PPP insisted the government would not write the letter. The PPP has a strong sense of victimisation, with its first leader, Zulfiqar Ali Bhutto, hanged, while his daughter was assassinated in 2007, a badge of martyrdom that is one of its central appeals to its electorate. Punishment by the courts could just add to its claim of persecution by the "establishment".

The government is fighting a second incendiary court case, the so-called memogate scandal, in which it is accused of treason, by attempting to plot with Washington against its own armed forces. The chief accuser in that case, US businessman Mansoor Ijaz, failed to show up in court yesterday, though his lawyer promised he would appear next week. The case, which has pitted the government in court against the military, looks likely to collapse without Ijaz's testimony.