When Julian Assange touched down at Arlanda airport in Stockholm on the morning of 11 August this year, the founder of the WikiLeaks website was beginning what he hoped would be a critical operation to shield his whistle-blowing platform from future attacks.
Buoyed by the release of thousands of US Army logs from Afghanistan, Assange, 39, was intending to settle in Sweden and take advantage of some of the strongest source protection legislation in the world. Yet that Swedish sojourn has become the most pressing threat to both his liberty and the future of WikiLeaks itself.
Within nine days of him arriving in Stockholm, two women had gone to the police alleging that the Australian-born campaigner had non-consensual sex with them. Their joint testimonies have led to a criminal prosecution on charges of rape, sexual molestation and unlawful coercion – a prosecution that was initially dropped for lack of evidence and then pursued with vigour as WikiLeaks geared up to publish thousands of US State Department cables.
As a country with a reputation for pioneering gender equality, Sweden has some of the toughest anti-rape laws in the world. It made spousal rape illegal in 1964 – 27 years before Britain did – and uses a particularly broad definition of what constitutes non-consensual sex.
His first accuser, who cannot be named in Sweden for legal reasons, is a feminist academic in her late thirties who worked as an official with Sweden's Social Democratic Party. She was in regular contact with Mr Assange before his move to Sweden, helping to organise his appearances at lectures as well as agreeing to let him use her flat while he was in Stockholm.
They first met in person on the afternoon of 14 August, when she returned to her flat after a few days away from the capital. According to her testimony, which was leaked to the Swedish media, the pair went out for dinner and returned to the flat, where they had sex. At some point a condom broke, a fact that neither side denies, although the woman alleges that it was broken deliberately by Mr Assange.
Mr Assange's first accuser made no immediate attempt to contact the authorities. It was only when she was contacted by the second accuser four days later that the pair decided to go to the police.
Instead the first woman arranged a "crayfish party" – a traditional Swedish summer get-together – for the following evening in honour of the WikiLeaks founder in her flat. In an entry on the woman's Twitter account, which she later tried to erase, Mr Assange's first accuser described her joy at hosting a party for the world's most famous cyber activist. "Sitting outside nearly freezing with the world's coolest people," she wrote. "It's pretty amazing."
What the first woman was unaware of was that Mr Assange had already begun flirting with another Swedish woman, whom he had met earlier that day at a talk he had given to a trade union.
Mr Assange's second accuser is in her early twenties and lives in the town of Enköping. She met Mr Assange and the first woman during a lunch after the talks. They flirted, watched a film together and "became intimate", but Mr Assange left that evening to attend the crayfish party.
The following Monday they met again and travelled to the woman's home in Enköping, where, according to the police testimony, they had consensual sex using a condom. The following morning, the woman alleges, Mr Assange had sex with her while she was asleep and didn't wear a condom.
At some point over the next three days Mr Assange's two lovers crossed paths and discovered that they had both slept with the same man. They both also claimed to have had their own experiences of a lover who was reluctant to use protection.
On 20 August the pair went to a police station in Stockholm to seek advice on how to make a complaint against Mr Assange, and investigate the possibility of forcing him to take an HIV test. After listening to their testimonies, a prosecutor decided that Mr Assange should be sought on suspicion of sexual molestation for the first woman, and rape for the second.
Within 24 hours Sweden's chief prosecutor dismissed the rape charge against Mr Assange, but the following month a separate prosecutor, Marianne Ny, reopened the case, resulting in the European arrest warrant that brought Mr Assange to court yesterday.
Ms Ny says that new evidence has come to light, and insists that the case has nothing to do with WikiLeaks.
Three of the four charges detailed in court yesterday relate to sexual relations with the first woman, and are peculiar to Swedish law. They include one count of "unlawful coercion" and two counts of "deliberate molestation". The most serious charge he is facing of rape relates to the second woman, and an accusation that he "had sexual intercourse with her by improperly exploiting the fact that she was asleep".
Mr Assange denies that the sex was non-consensual.
Ultimately the strength of the evidence will have to be tested in a Stockholm court – but even getting him there could take months.