Russian opposition leader Alexei Navalny entered the courtroom on Thursday to hear the verdict in his embezzlement trial in an apparently buoyant mood.
He jokingly asked: "Why is everyone looking so serious?"
But three-and-a-half hours later, the judge delivered a heavy blow that appeared to rattle the composure of a man who has shown no fear in exposing alleged corruption around President Vladimir Putin.
Judge Sergei Blinov ordered a five-year prison sentence for the 37-year-old lawyer who then only had seconds to say his final goodbyes before bailiffs in the court in the northern city of Kirov moved in to arrest him.
Navalny just had time to hug his wife and tearful mother and shake hands with his father before being handcuffed and led away.
His co-defendant Pyotr Ofitserov, who received the slightly milder punishment of four years in prison, embraced his wife for as long as possible before they had to part.
After arriving in Kirov a free man on Thursday on the night train from Moscow, Navalny was starting to serve his sentence in one of the city's two detention centres.
Well aware of what his sentence was likely to be, he reportedly had not bought a return railway ticket.
He was taken to detention centre number two in Kirov, where he will stay until his appeal is heard. If the sentence is confirmed, Navalny will then be sent to serve it out in a penal colony.
Nine prison guards clad in camouflage, bullet proof vests and helmets stood blocking the driveway outside the detention centre as several dozen Navalny supporters sat outside the railings.
Navalny was convicted with organising embezzlement of a timber firm while acting as an unpaid advisor to the governor of the Kirov region in 2009.
Since Putin's return to the Kremlin last May, the authorities have raked over Navalny's past and opened so many probes against him that he says he has lost count. The Kirov case is just the first to go to trial.
The historic iron-porched courthouse in the low-rise city of Kirov, 900 kilometres (560 miles) north of Moscow, was an unlikely setting for an extraordinary trial that saw more than 100 journalists arriving from 4:00 am to secure a spot.
Dressed in a checked shirt and jeans, Navalny had tweeted irreverently as the judge read out the conviction in an almost inaudible rapid monotone.
Navalny even complained on Twitter that he had a problem: his phone battery was about to die. He also gleefully suggested that the court should start a Mexican wave.
Sitting beside lawyers, Navalny directed warm glances at his wife Yulia, who wore plastic wristbands saying "Team Navalny" and "For Navalny".
There were no mitigating circumstances, said the judge, announcing a sentence of five years in a prison camp, a year less than sought by prosecutors.
Usually so ready with a catchy soundbite, Navalny did not say a word to journalists as he was led away.
"May God have mercy on You," read the slogan on a picture of Putin that Navalny tweeted before handing over his telephone to his wife.
Navalny, who has a daughter aged 12 and a son aged five, could stay in prison until 2018, the same year when Putin could stand for a fourth term in the next presidential elections.
Later, Navalny's wife, who is widely expected to take a much bigger public role after her husband's conviction, emerged on the court porch, with tears in her eyes but perfectly controlled as she called for supporters to carry on the fight.
"We will win. Please believe too that everything will be great."