Pakistani Prime Minister Yousuf Raza Gilani waves upon his arrival at the Supreme Court for a hearing in Islamabad. Judges charged him with contempt for defying their orders to reopen an old corruption case against his political ally, President Asif Ali Zardari. (B.K. Bangash/AP)

Pakistan’s Supreme Court formally charged embattled Prime Minister Yousuf Raza Gilani with contempt Monday, as his party and coalition in parliament rallied behind him.

Gilani, who pleaded not guilty, has steadfastly defied court orders to reopen old corruption cases against Pakistani President Asif Ali Zardari. If convicted, Gilani would face six months in jail and possible removal from office.

The trial, which is scheduled for Feb. 22, could take several weeks, continuing the crisis atmosphere that has gripped the capital as the showdown between the government and judiciary has escalated. Gilani maintains that the constitution grants Zardari immunity from prosecution. The court says that the rule of law cannot be compromised by allowing the prime minister to flout the court’s orders.

The continued political upheaval is dangerous, analysts say, because it puts pressure on an already weak civilian government. The crisis also distracts from crucial efforts to repair relations between Pakistan and the United States at a time when Pakistan is considered a key player in efforts to bring peace to Afghanistan.

To signal stability, Gilani quickly summoned to his residence government ministers and parliamentary leaders from the various parties that support his ruling Pakistan People’s Party. “The coalition partners expressed complete solidarity with the government,” the group said in a statement.

Before Monday’s hearing, paramilitary troops and police put the capital’s government sector on lockdown. Helicopters hovered in the rainy skies over the capital.

Security forces were already on high alert because of recent fears that militants might lob mortar rounds toward the capital or mount some other form of attack. Police in recent days recovered two mortars from a town on Islamabad’s outskirts. They told the Express Tribune newspaper that at least one of the mortars resembled those used in the shelling last month of the Pakistan Military Academy in Abbottabad, the garrison town where U.S. forces killed Osama bin Laden last May.

On Monday morning, Gilani drove himself to court in a white Toyota Land Cruiser, as he had in a previous court appearance. The Supreme Court earlier had asked the prime minister not to bring his car inside the premises and to instead leave it outside the court compound as an ordinary citizen would.

But late Sunday, the court relented, after the government cited security concerns.

Inside the marble-walled courtroom, with its translucent ceiling soaring five stories overhead, the prime minister stood at the rostrum as the charge sheet was read.

Justice Nasir ul Mulk, who heads the seven-judge panel handling the case, said Gilani must stand trial because the prime minister had failed to write a letter to Swiss authorities to revive money-laundering and kickback cases involving Zardari dating to the 1990s.

Asked whether he had heard the indictment, Gilani replied, “Yes, I have heard it and I also understand what it means.”

Although two previous Pakistani prime ministers, Zulfiqar Ali Bhutto and Nawaz Sharif, have received contempt-of-court notices, Gilani is the first to be formally indicted on that charge.

“We are standing here with a sad heart. It’s a very sad day in the history of the country,” Qamar Zaman Kaira, a senior leader of Pakistan People’s Party, told journalists after the hearing.

But he quashed any speculation about Gilani stepping down, saying: “He is the prime minister and he will continue to be the prime minister.”

Correspondent Shaiq Hussain contributed to this report.