Wikileaks founder Julian Assange was sentenced to nearly a year in jail for skipping bail as he prepares to fight extradition to the U.S.

Assange was last month found guilty of bail violations following his dramatic arrest in London. The 47-year-old had been holed up inside the Ecuadorian embassy since 2012 as he sought to escape questioning in a Swedish sexual-assault case.

Judge Deborah Taylor at a London court hearing Wednesday sentenced him to 50 weeks in jail, saying he deliberately evaded justice.

Assange said in a letter that he regretted the course that his actions took.

"I found myself struggling with terrifying circumstances," Assange said in a letter read out by his lawyer. "I did what I thought at the time was the best or perhaps the only thing that I thought could be done."

While the British sentence takes precedence, Assange’s imprisonment is unlikely to delay the U.S. request. American authorities are pursuing extradition so he can face trial on charges that he conspired with ex-U.S. Army analyst Chelsea Manning to disclose classified government material.

A trim-looking Julian Assange raised his fist to a gallery of supporters, who shouted "shame on you" as the judge left the court.

The U.K. hearing took place hours before U.S. Attorney General William Barr, who has ultimate oversight of the Assange indictment, is set to testify before Senate and House panels on Robert Mueller’s Russia report. Lawmakers will press him to reconcile his findings with those of the special counsel.

The British bail violation relates to a Swedish investigation into an alleged rape. While he was out on bail in that case, Assange sought asylum in Ecuador’s embassy. As the years dragged on, Stockholm prosecutors dropped the investigation because it had become impossible to pursue in his absence.

"It is difficult to envisage a more serious example of this offense," the judge said. “You may have had fears as to what may happen to you, nonetheless you had a choice.”

The judge said the U.K. had spent 16 million pounds (US$21 million) while Assange was in the embassy.