WikiLeaks founder Julian Assange was sentenced to 50 weeks in jail Wednesday for jumping bail when he took refuge inside the Ecuadorean embassy in London.

Assange was arrested last month after spending nearly seven years inside the embassy to avoid extradition to Sweden, where he faced sexual assault allegations. He told Southwark Crown Court in South London on Wednesday that “I did what I thought at the time was the best or perhaps the only thing that I could have done,” the BBC reported.

Assange also apologized to those who “consider I’ve disrespected them.” Ecuadorean officials, who decided to revoke his asylum and give him up to British authorities, complained of erratic, aggressive and unsanitary behavior by Assange inside the embassy, which is located in one of toniest parts of London.

“The patience of Ecuador has reached its limit,” Lenin Moreno, Ecuador’s president, said at the time.

Sweden dropped its investigation into Assange in May 2017, citing statute of limitations. But the U.S. has requested that Assange be extradited there face charges over the leak of a massive trove of classified American military documents. Assange and his backers have argued that he could face the death penalty in the U.S. and that Britain, which abolished capital punishment decades ago, should not send him there.

In video footage of his arrest last month by officers from Scotland Yard, Assange can be heard saying: “The U.K. must resist this attempt by the Trump administration.” An extradition hearing is scheduled for Thursday.

Shortly after his arrest April 11, Assange was found guilty of breaching bail by a judge who called him a “narcissist who cannot get beyond his own selfish interest.”

At Wednesday’s sentencing, Assange’s lawyer, Mark Summers, asked that the court take into account the fear his client felt at the prospect of being delivered to U.S. authorities. “As threats rained down on him from America, they overshadowed everything,” Summers said.

After Assange was given his 50-week jail sentence, he reportedly raised his fist in defiance in the courtroom, which was packed with supporters who shouted “Shame on you!” at court authorities.