She pointed out that he had not surrendered "willingly" and was only facing the court because the government of Ecuador withdrew its protection last month.
The Australian secret-spiller had lived in the South American country's London embassy since June 2012 to avoid extradition to Sweden, where he was wanted for questioning over rape and sexual assault allegations made by two women.
He was arrested by British police April 11 after Ecuador revoked his political asylum, accusing him of everything from meddling in the nation's foreign affairs to poor hygiene.
Assange faces a separate court hearing Thursday on a US extradition request.
American authorities have charged Assange with conspiring to break into a Pentagon computer system.
Taylor said Assange's seven years in the embassy had cost British taxpayers
$US21 million, and said he sought asylum as a "deliberate attempt to delay justice."
Assange stood impassively with his hands clasped while the sentence was read.
His supporters in the public gallery at Southwark Crown Court cheered for him as he left and chanted "Shame on you" at the judge as Assange was led away.
He raised his fist in a show of defiance.
With his white hair freshly coiffed and wearing a black sports jacket and grey sweater, Assange looked much more youthful and healthier than when he was dragged out of the Ecuadorian Embassy by British police.
At the time, sporting an unkempt beard and long hair, he seemed wild-eyed and angry.
This time he was composed and for the most part polite, although he did interrupt the judge to challenge her on her characterisation of the sexual misconduct allegations he faced in Sweden.
His lawyer read out a brief letter from Assange to the judge in which he apologized "unreservedly" to anyone who felt his actions had been disrespectful.
"I found myself struggling with terrifying circumstances for which neither I nor those from whom I sought advice could work out any remedy," he said in the letter.
"I did what I thought at the time was the best and perhaps the only thing that could be done."
Sweden suspended its investigation into possible sexual misconduct against Assange two years ago because he was beyond their reach while he was living in the embassy.
Prosecutors have said that investigation could be revived if his situation changed.
Assange's lawyer Mark Summers told a courtroom packed with journalists and WikiLeaks supporters that his client sought refuge in the Ecuadorian Embassy because "he was living with overwhelming fear of being rendered to the US," over his WikiLeaks activities.
He said Assange had a "well-founded" fear that he would be mistreated and possibly sent to the US detention camp for terrorism suspects at Guantanamo Bay.
WikiLeaks editor-in-chief Kristinn Hrafnsson said after the sentencing that the extradition battle with the US is now the "big fight" facing Assange.
"It will be a question of life and death for Mr Assange," he said.
There was a small gathering of vocal Assange supporters outside the courthouse demanding he be freed.
One person was dressed as a whistle to emphasise Assange's role as a whistleblower.
-AP