JULIAN Assange has been jailed for 50 weeks for breaching his bail conditions after going into hiding in the Ecuadorian embassy in London while he was wanted over allegations of sexual offences.

The WikiLeaks founder spent nearly seven years living in the embassy – where he sought political asylum – until last month, when he was dramatically dragged out by police.

Assange wrote to Southwark Crown Court, apologising for his actions, which he said he regretted and acknowledged may have placed him in a graver situation.

Judge Deborah Taylor said this was the first time he had expressed contrition over his actions, which she said cost at least £16 million in public funds.The judge told him it was “difficult to envisage a more serious example” of breaching the Bail Act, as she sentenced him to 50 weeks’ imprisonment, just short of the one year maximum.

Assange defiantly raised his fist to supporters when he was led to the cells. They shouted “free Julian” and “shame on you” to the court.

Moments earlier, Judge Taylor had told Assange: “Firstly, by entering the embassy, you deliberately put yourself out of reach, whilst remaining in the UK.

“You remained there for nearly seven years, exploiting your privileged position to flout the law and advertise internationally your disdain for the law of this country.”

She said his actions “undoubtedly” affected Swedish prosecutors’ efforts, which were discontinued “not least because you remained in the embassy”.

In a bid to secure a lower sentence, the 47-year-old wrote to the court saying he went into hiding while “struggling with terrifying circumstances”. “I apologise unreservedly to those who consider that I have disrespected them by the way I have pursued my case,” he wrote.

“I did what I thought at the time was the best and perhaps the only thing that could be done – which I hoped might lead to a legal resolution being reached between Ecuador and Sweden that would protect me from the worst of my fears. I regret the course that this took.”

In mitigation for Assange, Mark Summers QC told the court the Australian had been “gripped” by fears of rendition to the US due to his work with WikiLeaks, citing examples where Sweden had sent people to states where they were “at significant risk of ill-treatment, including torture and death”.

Assange entered the embassy in 2012 while under scrutiny over the leaks of classified US diplomatic cables on his whistleblowing website. The move came after he exhausted legal options in fighting extradition to Sweden over two – one of rape and one of molestation.

He will today face a hearing about his potential extradition to the US. Prosecutors in Sweden are also considering whether to reopen the sexual assault case, dropped in May 2017. Assange denies the allegations.