WikiLeaks founder Julian Assange has been jailed for 50 weeks for breaking his bail while he was wanted over allegations of sexual offences.
Assange took refuge in the Ecuadorian embassy in London for seven years, claiming political asylum, before he was dramatically dragged out by police last month.
Before he was sentenced his lawyer read a letter written by Assange to Southwark Crown Court.
It read: "I apologise unreservedly to those who consider that I have disrespected them by the way I pursued my case.
"I found myself struggling with difficult circumstances.
"I did what I thought at the time was the best or perhaps the only thing that I could have done.
"I regret the course that that has taken."
The judge told Assange: "By hiding in the embassy you deliberately put yourself out of reach, while remaining in the UK."
She told Assange that by doing so he had "exploited your privileged position to flout the law".
Read more from Yahoo News UK:
Mark Summers QC told the court the Australian had been "gripped" by fears of rendition to the US due to his work with WikiLeaks.
But the judge found that the background to the case was being used as mitigation "rather than as any reasonable excuse" for Assange's failure to surrender.
As he was taken down to the cells, Assange defiantly raised his fist to the supporters in the public gallery behind him.
They raised their fists back at him in solidarity and shouted “Shame on you” towards the court.
Speaking outside court, WikiLeaks editor-in-chief Kristinn Hrafnsson said the sentence was an "outrage" and "vindictive in nature".
"It doesn't give us a lot of faith in the UK justice system for the fight ahead," he told a crowd packed with journalists and supporters.
"Only two weeks short of the maximum is an outrage."
Mr Hrafnsson said the battle against Assange’s extradition to the US is now the "big fight".
"It will be a question of life and death for Mr Assange," he said.
"It's also a question of life and death for a major journalist principle."
Mr Hrafnsson also drew a comparison with the sentence of speedboat killer Jack Shepherd.
"And may I point out, just in comparison, that the so-called speedboat killer got six months for not showing up in court to hear his sentencing for manslaughter," the editor said.
Assange entered the Ecuadorian embassy on June 19 2012 while under intense scrutiny over leaks of hundreds of thousands of classified US diplomatic cables on his whistleblowing website.
He moved in after exhausting all legal options in fighting extradition to Sweden over two separate allegations, one of rape and one of molestation.
Assange, claiming he was the subject of an American "witch hunt", said he was at risk of being further taken to the US if he was sent to Sweden.
On Thursday, he will face a hearing about his potential extradition to the US over the allegation he conspired with intelligence analyst Chelsea Manning to infiltrate Pentagon computers.
Prosecutors in Sweden are also mulling whether to reopen the sexual assault case against Assange, which was dropped in May 2017. Assange denies the allegations.
His eviction from the embassy on April 11 came after a souring of relations, with Ecuador's president Lenin Moreno claiming the Australian had tried to use the Knightsbridge site for spying.
Hours later he was taken to Westminster Magistrates' Court, where he was found guilty of the bail breach, which came when he failed to surrender to police on June 29 2012.