WikiLeaks founder Julian Assange has been sentenced to 50 weeks in prison for violating his bail and going into hiding at the Ecuadorian embassy, seven years ago, a sentence that comes just a day before a hearing is set to take place concerning his extradition to the U.S.

Assange was sentenced on Wednesday after his appearance at London’s Southwark Crown Court. After the judge handed the sentence, a group of protesters shouted “shame on you.”

VIDEO SHOWS JULIAN ASSANGE SKATEBOARDING IN ECUADORIAN EMBASSY, ARGUING WITH SECURITY GUARDS

WikiLeaks founder Julian Assange arrives at court in London on May 1, 2019 to be sentenced for bail violation.

WikiLeaks founder Julian Assange arrives at court in London on May 1, 2019 to be sentenced for bail violation. (AFP/Getty)

He breached his bail back in 2012 amid threats of extradition to Sweden, where he was wanted for questioning over rape and sexual assault allegations.

In a letter read to the court, Assange said he was “struggling with difficult circumstances” and apologized to those who “consider I've disrespected them.”

He added: “I did what I thought at the time was the best or perhaps the only thing that I could have done.”

Protesters outside court as Julian Assange will appear to be sentenced on charges of jumping British bail seven years ago, in London, Wednesday May 1, 2019. Founder of WikiLeaks whistleblower website, Assange faces a separate court hearing later, on a U.S. extradition request, after being arrested at the Ecuadorian embassy April 11, when his political asylum was withdrawn.(AP Photo/Matt Dunham)

Protesters outside court as Julian Assange will appear to be sentenced on charges of jumping British bail seven years ago, in London, Wednesday May 1, 2019. Founder of WikiLeaks whistleblower website, Assange faces a separate court hearing later, on a U.S. extradition request, after being arrested at the Ecuadorian embassy April 11, when his political asylum was withdrawn.(AP Photo/Matt Dunham)

Judge Deborah Taylor insisted that Assange deserved near the maximum sentence of one year because of the seriousness of his offense. She rejected calls for leniency because of the nearly seven years he spent in the Ecuadorian Embassy.

The Australian founder of WikiLeaks remained defiant and raised a fist in the air to his supporters as he was taken down to the prison.

Assange has been held in prison since his arrest last month after the Ecuadorian authorities revoked his political asylum and kicked him out of the embassy on April 11.

Assange was sentenced on Wednesday after his appearance at London’s Southwark Crown Court. After the judge handed the sentence, a group of protesters shouted “shame on you.”<br data-cke-eol="1">

Assange was sentenced on Wednesday after his appearance at London’s Southwark Crown Court. After the judge handed the sentence, a group of protesters shouted “shame on you.”

JULIAN ASSANGE'S ARREST DRAWS FIERCE INTERNATIONAL REACTION

The government of Ecuador accused WikiLeaks and Assange of meddling in the country’s politics.

But the sentence on Wednesday is just a sideshow for Assange, who faces the main battle on Thursday.

He’s set to appear at a court hearing on a U.S. extradition request. The U.S. authorities charged Assange with conspiring to break into a Pentagon computer system.

CLICK HERE TO GET THE FOX NEWS APP

He faces up to five years in a U.S. prison if convicted.

The Associated Press contributed to this report.