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.
Before sentencing by Judge Deborah Taylor for breaching the Bail Act, his lawyer, Mark Summers QC, read a letter written by Assange to Southwark Crown Court on Wednesday.
Assange wrote: “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 47-year-old entered the embassy on June 19, 2012 while under intense scrutiny over leaks of hundreds of thousands of classified US diplomatic cables on his whistleblowing website.
The drastic move came after he exhausted 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 the Scandinavian nation.
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.
On Wednesday, the streets leading up to the Southwark court were lined with barriers, with security anticipating groups of demonstrators.
Court One, the largest in the building, attracted queues of journalists awaiting the judgment and members of the public eager to get a glimpse of Assange as he appeared in custody.