It now emerges that the last four years of Julian Assange’s effective imprisonment in the Ecuadorean embassy in London have been entirely unnecessary. In fact, they depended on a legal charade.

Behind the scenes, Sweden wanted to drop the extradition case against Assange back in 2013. Why was this not made public? Because Britain persuaded Sweden to pretend that they still wished to pursue the case.

In other words, for more than four years Assange has been holed up in a tiny room, policed at great cost to British taxpayers, not because of any allegations in Sweden but because the British authorities wanted him to remain there. On what possible grounds could that be, one has to wonder? Might it have something to do with his work as the head of Wikileaks, publishing information from whistleblowers that has severely embarrassed the United States and the UK.

In fact, Assange should have walked free years ago if this was really about an investigation – a sham one at that – into an alleged sexual assault in Sweden. Instead, as Assange has long warned, there is a very different agenda at work: efforts to extradite him onwards to the US, where he could be locked away for good. That was why UN experts argued two years ago that he was being “arbitrarily detained” – for political crimes – not unlike the situation of dissidents in other parts of the world that win the support of western liberals and leftists.

According to a new, limited release of emails between officials, the Swedish director of public prosecutions, Marianne Ny, wrote to Britain’s Crown Prosecution Service on 18 October 2013, warning that Swedish law would not allow the case for extradition to be continued. This was, remember, after Sweden had repeatedly failed to take up an offer from Assange to interview him in London, as had happened in 44 other extradition cases between Sweden and Britain.

Ny wrote to the CPS: “We have found us to be obliged to lift the detention order … and to withdraw the European arrest warrant. If so this should be done in a couple of weeks. This would affect not only us but you too in a significant way.”

Three days later, suggesting that legal concerns were far from anyone’s mind, she emailed the CPS again: “I am sorry this came as a [bad] surprise… I hope I didn’t ruin your weekend.”

In a similar vein, proving that this was about politics, not the law, the chief CPS lawyer handling the case in the UK, had earlier written to the Swedish prosecutors: “Don’t you dare get cold feet!!!”

In December 2013, the unnamed CPS lawyer wrote again to Ny: “I do not consider costs are a relevant factor in this matter.” This was at a time when it had been revealed that the policing of Assange’s detention in the embassy had at that point cost Britain £3.8 million. In another email from the CPS, it was noted: “Please do not think this case is being dealt with as just another extradition.”

These are only fragments of the email correspondence, after most of it was destroyed by the CPS against its own protocols. The deletions appear to have been carried out to avoid releasing the electronic files to a tribunal that has been considering a freedom of information request.

Other surviving emails, according to a Guardian report last year, have shown that the CPS “advised the Swedes in 2010 or 2011 not to visit London to interview Assange. An interview at that time could have prevented the long-running embassy standoff.”

Assange is still holed up in the embassy, at great risk to his physical and mental health, even though last year Sweden formally dropped an investigation that in reality it had not actually been pursuing for more than four years.

Now the UK (read US) authorities have a new, even less credible pretext for continuing to hold Assange: because he “skipped bail”. Apparently the price he should pay for this relatively minor infraction is more than five years of confinement.

London magistrates are due to consider on Tuesday the arguments of Assange’s lawyers that he should be freed and that after so many years the continuing enforcement of the arrest warrant is disproportionate. Given the blurring of legal and political considerations in this case, don’t hold your breath that Assange will finally get a fair hearing.

Remember too that, according to the UK Foreign Office, Ecuador recently notified it that Assange had received diplomatic status following his successful application for Ecuadorean citizenship.

As former British ambassador Craig Murray has explained, the UK has no choice but to accept Assange’s diplomatic immunity. The most it can do is insist that he leave the country – something that Assange and Ecuador presumably each desire. And yet the UK continues to ignore its obligation to allow Assange his freedom to leave. So far there has been zero debate in the British corporate media about this fundamental violation of his rights.

One has to wonder at what point will most people realise that this is – and always was – political persecution masquerading as law enforcement.