Image caption Mr Gilani can continue as prime minister while court proceedings take place

Pakistan's Supreme Court has issued a contempt order against Prime Minister Yousuf Raza Gilani, raising the prospect of his prosecution.

The court has been considering what to do about the government's refusal to reopen corruption cases against the president and other political figures.

Mr Gilani says that he will appear in person at the court on Thursday to defend himself.

His announcement came on a day of several challenges for the government.

It is locked in a war of words with the army in addition to its tussle with the judiciary.

The prime minister said that his decision to appear before the court was a sign that he respected its authority.

He was speaking in parliament in Islamabad after MPs passed a resolution in support of democracy and the constitution.

Mr Gilani described the vote as "good news for Pakistan".

Correspondents say that even some opposition parties supported the resolution - the outcome of which was a foregone conclusion because it was seen as support for democracy in the country in general.

But it was not a personal vote of confidence in Mr Gilani himself, correspondents say.

Meanwhile another court hearing is taking place into a controversial anonymous memo which asked for US help to avert an army coup in Pakistan, in the wake of the killing of Osama Bin Laden in May 2011, has also resumed.

It is understood that Mr Gilani can continue as prime minister while court proceedings take place. If contempt proceedings go ahead and he is found guilty, he could be automatically disqualified from holding public office.

Analysis By putting Prime Minister Gilani on a contempt notice, the Supreme Court in Pakistan has taken its recent stand-off with the government a step further. A destabilising factor over the last few weeks has been the country's powerful military, which is actively participating in the memo case, which could potentially bring down President Asif Ali Zardari on the charge of treason. It is also said to be supporting the judiciary against Mr Gilani. But the government is also likely to deploy techniques that will help it to delay a conviction against the prime minister. The vote in parliament was meant to display unity between political players and aims to discourage unelected institutions from taking action against the government.

Intense uncertainty

At the heart of the court's complaint is the government's refusal to act on a court order quashing a controversial amnesty, which had protected the country's senior politicians from corruption prosecutions.

One of the cases at stake is against Pakistan's President Asif Ali Zardari - the government insists he has immunity from prosecution as president.

But the deadline for the government to reopen the corruption cases expired on Monday and government representatives were summoned to court to explain what they planned to do.

"The Supreme Court has issued a contempt of court notice to the prime minister for not complying with its orders," AFP news agency reported judge Nasir-ul-Mulk as telling the court.

The order comes at a time of intense political uncertainty, with the government at loggerheads with country's powerful military as well as the judiciary.

The government's stand-off with the military escalated sharply last week when the army publicly rebuked Mr Gilani warning of "potentially grievous consequences" after he criticised army leaders in a media interview and sacked his defence secretary.

Pakistan has suffered three military coups since independence in 1947 but analysts believe the army has little appetite for a coup in this instance.

THREE KEY FLASHPOINTS Supreme Court corruption case: Government's refusal to reopen corruption cases led to a contempt order for PM Yousuf Raza Gilani. If found guilty he could be disqualified from office.

Government's refusal to reopen corruption cases led to a contempt order for PM Yousuf Raza Gilani. If found guilty he could be disqualified from office. Supreme Court 'memogate' inquiry: This is considering whether President Zardari was involved in a memo asking for US help to avert an army coup. He could be charged with treason.

This is considering whether President Zardari was involved in a memo asking for US help to avert an army coup. He could be charged with treason. Parliamentary vote: Parliament backed Pakistan's political leadership and democratic system on Monday - a welcome bonus for the government. Q&A: Renewed instability in Pakistan

Correspondents say things appeared to have calmed down after talks between civilian and military elites over the weekend when Mr Gilani described the armed forces as "a pillar of the nation's resilience and strength".

The BBC's M Ilyas Khan says the army is throwing its weight behind the judiciary as it pursues its cases against the government.

'Memogate' inquiry

The other court hearing being considered today concerns the so-called "memogate" scandal - the anonymous memo apparently seeking help from the US to avert a possible military coup.

It is not clear who wrote the memo or conveyed it to Washington. US officials say they received the memo but took no action.

The scandal has already cost Pakistan's former ambassador to Washington, Husain Haqqani, his job. He denies any role in the memo, as does Pakistan's President Zardari.

The commission, set up last month, is expected to question government officials to try to establish whether they endorsed the memo, and if so, whether the cabinet can remain in power.

The next key date in this inquiry is 25 January, when Mansoor Ijaz, the person responsible for delivering the memo and who revealed its existence in the first place, is set to appear before court.

The findings of the investigation are due to be announced later this month.