The decision at Stockholm city court to keep the detention order against the WikiLeaks founder Julian Assange is the latest act in a highly publicised legal drama played out over four years in front of magistrates, senior judges and law lords at the high court and supreme courts in London.

Assange has been holed up for more than two years in the Ecuadorian embassy in London evading extradition, and has become a hero figure for a diverse range of visitors ranging from Lady Gaga to the former footballer Eric Cantona.

It all began in far more private circumstances when, in August 2010 Assange, met two young women in Stockholm with whom he went to bed on separate nights. Afterwards they accused him of rape and sexual assault.

At the time, Assange had recently published video of a US Apache helicopter shooting a Reuters camera crew in Iraq, dubbed "collateral murder". It was to be the first of a series of blockbuster revelations from leaked US government files that WikiLeaks had obtained.

The sexual assault allegations quickly became entangled with Assange's fears about the US authorities' backlash over the leak of hundreds of thousands of military logs from Iraq and Afghanistan and diplomatic cables from US embassies across the globe. Assange said the issue of the charges "at this moment is deeply disturbing".

In a high court challenge against the subsequent arrest warrant, the judges were told by counsel for the Swedish authorities that the women were "coerced, either by physical force or they were trapped into a situation where they had no choice". Assange has always proclaimed his innocence.

Clare Montgomery QC said one of the women claimed "the prelude to the offence was Mr Assange ripping her clothes off, breaking her necklace, her trying to get dressed again and then letting him undress her". She said he then had sex with her after pinning her arms and trying to force her legs apart, which she did not want.

Assange's side said the claims were baseless and the arrest warrant illegal. His counsel in 2011, Ben Emmerson, said police reports in Sweden showed that one of the women had told a friend that she felt police and others around her "railroaded her" into pressing charges. She had only wanted the police to force Assange to take a blood test after she became worried about HIV after unprotected sex with him, he said.

Assange did not want to go to Sweden to face questioning, partly because he believed and continues to believe that he would be extradited to the US to face charges related to his WikiLeaks work. Last year the former US army soldier Chelsea Manning was jailed for 35 years for leaking classified state documents to Assange.

For the first period of his bail, Assange was hosted at Ellingham Hall in Norfolk, home of the founder of the Frontline Club for journalists, Vaughan Smith. During this period, the legality of Sweden's arrest warrant was upheld by Westminster magistrates court, then by Lord Thomas, the lord chief justice, and Mr Justice Ouseley at the high court in November 2011, and finally by the supreme court in June 2012.

That paved the way for his extradition, but on Tuesday 19 June he sought political asylum at the Ecuadorian embassy in Knightsbridge. He has been there ever since.

Claes Borgström, a lawyer for the two Swedish women, said his move into the embassy was frustrating and disappointing for his clients. "The tragedy is that he doesn't take his responsibility," he said.

One year into his stay at the small diplomatic mission, Assange said: "We know there is an ongoing investigation in the US and we know I am a target of the federal grand jury. There is a 99.97% chance that I will be indicted. So if the Swedish government drops their request [to go to Sweden] tomorrow, I still cannot leave the embassy."

The embassy has been ringed by police for 24 hours a day at a cost of more than £6m to the British taxpayer.

The latest chapter comes because Sweden's code of judicial procedure was updated on 1 June to conform with EU law. It now includes a provision that anyone arrested or detained has the right to be made aware of "facts forming the basis for the decision to arrest".

Assange has claimed that text messages sent by one of his accusers show that she was ambivalent about his arrest and even opposed to it. "The messages strongly suggest that there is no basis for the arrest and they are thus vital so that he [Assange] can effectively tackle the arrest warrant," the lawyers say in documents filed with Stockholm district court this week. © Guardian News and Media 2014