Julian Assange has been jailed over a nearly seven-year stay in the Ecuadorian embassy which defied his bail conditions and cost the taxpayer £16m.

The WikiLeaks founder was handed close to the maximum sentence for skipping bail in 2012, when an extradition to Sweden to face sexual assault allegations loomed.

The 47-year-old said he was fearful of a suspected US plot to kidnap and transport him to Guantanamo Bay following the publication of damaging military leaks online.

He was granted political asylum by Ecuador in August 2012 and lived in its London embassy until relations collapsed irreparably last month, leading to his arrest.

On Wednesday, a judge revealed Assange’s self-imposed exile had drained £16m from the public purse, largely for a round-the-clock police watch lasting three years.

Judge Deborah Taylor told Southwark Crown Court she rejected the computer programmer’s defence that he was simply “exercising his human rights” when he failed to surrender to the court.