Pakistan's prime minister has been convicted of contempt of court by the country's highest court but given only a token sentence in a case that could still see him thrown out of office.
The Supreme Court found Yousuf Raza Gilani guilty of contempt over his refusal to obey an order to write to the authorities in Switzerland to ask them to re-open corruption cases against President Asif Ali Zardari.
Gilani had faced a maximum sentence of six months in prison, but the court ordered him to be "imprisoned" until the hearing adjourned and he emerged shortly afterwards smiling and waving to supporters.
The question now is whether Gilani -- Pakistan's longest serving prime minister -- will be disqualified from office, which would add to political instability in a country already troubled by Al-Qaeda and Taliban violence.
Under Pakistan's constitution anyone convicted of defaming or ridiculing the judiciary is barred from being an MP, but legal experts say the process to disqualify Gilani could be a lengthy one, involving the parliamentary speaker and the Election Commission.
"For reasons to be recorded later Prime Minister and chief executive Yousuf Raza Gilani is found guilty and convicted for contempt of court," Justice Nasir ul Mulk, the head of the seven-judge Supreme Court bench, said.
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.
"He is therefore punished under section five of contempt of court ordinance with imprisonment till rising of the court," the judge said.
The case has been highly politically charged, with members of the government accusing judges of over-stepping their reach and of trying to bring down the prime minister and president, a year before the administration would become the first in Pakistan to complete an elected term.
Cabinet minister Firdous Ashiq Awan of Gilani's ruling Pakistan People's Party (PPP) told reporters outside court that the premier would launch an appeal.
"Today is another black day in Pakistan's history. Democracy was ambushed again," she said.
The corruption allegations against Zardari date back to the 1990s, when he and his late wife, former premier Benazir Bhutto, are suspected of using Swiss bank accounts to launder about $12 million allegedly paid in bribes by companies seeking customs inspection contracts.
The Swiss shelved the cases in 2008 when Zardari became president and a prosecutor in Switzerland has said it will be impossible to re-open them as long as he remains head of state and so is immune from prosecution.
Gilani insists the president has full immunity, but in December 2009 the Supreme Court overturned a political amnesty that had frozen investigations into the president and other politicians.
Gilani left the court amid a scrum of journalists and PPP supporters.
Security was tight outside the court for the hearing, with around 200 riot police armed with shields and batons stationed outside and approaches closed to the public.