Yousuf Raza Gilani, the Pakistani prime minister, has been convicted by the country's Supreme Court of having committed contempt of court in a case that could see him expelled from office.
Gilani was sentenced to be detained in the court until the hearing was adjourned, the state broadcaster reported, and shortly afterwards emerged smiling and waving to supporters.
"For reasons to be recorded later, the prime minister is found guilty of contempt for wilfully flouting the direction of the Supreme Court," said Justice Nasir-ul-Mulk while reading the verdict.
The judge said Gilani's offence "tends to bring this court and the judiciary of the country into ridicule".
The conviction was "likely to entail serious consequences" for Gilani under the section of the constitution covering the disqualification of MPs, Mulk said, and this was taken as a mitigating factor in sentencing.
The prime minister had faced a maximum sentence of six months in jail in the case, but was subjected only to a symbolic detention until "the rising of the court".
A conviction for contempt of court could rule him out of holding public office, however.
Gilani to appeal
Earlier, Gilani was cheered by many supporters as he arrived at the supreme court building in Islamabad on Thursday morning.
The court was ruling whether Gilani was guilty of committing contempt of court by failing to obey its order to write to authorities in Switzerland requesting them to reopen a corruption case against Asif Ali Zardari, the Pakistani president.
The court had ordered Zardari's case, and several others, reopened after it struck down the National Reconciliation Ordinance (NRO), a controversial 2007 amnesty law, as being unconstitional.
Gilani says that reopening a case against a sitting president would itself be unconstitutional, as the holder of the post enjoys legal immunity while in office.
The contempt case, in court since January, has caused political instability and could force the holding of early elections if Gilani is finally disqualified from parliament and legislators cannot agree on a replacement.
Aitzaz Ahsan, Gilani's lawyer and a sitting senator representing the PPP, said that his client would be appealing the verdict.
Federal Minister Firdous Ashiq Awan, a member of Gilani's ruling Pakistan People's Party (PPP), said Gilani's cabinet would be meeting the government's legal team on Thursday. The party's leadership was also due to meet with its coalition partners to discuss the verdict.
After the announcement of the verdict, Nawaz Sharif, the leader of the main opposition PML-N party, demanded that Gilani resign immediately "without causing further crisis".
Irfan Qadir, the country's attorney-general and a PPP loyalist, meanwhile, termed the court order "absolutely illegal".
"This order is to be ignored," he said.
Even though he was convicted by the seven-member bench on Thursday, disqualification from holding public office is not a straightforward affair.
"The speaker of the National Assembly [the lower house of parliament] will be informed to process his disqualification as an MP on the basis of the conviction," Rashid Rizvi, a former supreme court judge, said.
"The speaker has to write to the Election Commission of Pakistan within 30 days after the verdict to unseat the prime minister."
The Election Commission would then have a further 90 days to make a decision on the case.
Gilani also has the right to appeal to a larger supreme court bench, Rizvi said, meaning the process could continue until an election date is announced.
"Since he is prime minister, the court can also suspend its own order for 15 days to enable his counsel to file an appeal," he said.
Rehman Malik, interior minister, said that he had ordered tight security measures to be taken around the court, with four helicopters to be stationed overhead for aerial surveillance.
About 200 riot police, armed with shields and batons, were stationed outside the court on Thursday, and approaches to the building had been closed to the public.
He urged activists from Gilani's ruling Pakistan People's Party (PPP) not to come to the court, however, and asked them to remain calm regardless of the outcome.
Zardari and former prime minister Benazir Bhutto, his late wife, were suspected of having used Swiss bank accounts to launder more than $10m, allegedly paid in bribes by companies seeking customs inspections contracts in the 1990s.
The cases were shelved, however, after the NRO was passed and Zardari became president soon after.
Were Gilani's government's to see out its term until March 2013, it would be the first democratically elected government to do so. Gilani is already the longest-serving prime minister in Pakistan's chequered history with democracy.