Uppsala, Sweden CNN  — 

Julian Assange won a major legal victory on Monday, when a Swedish court denied a request to detain the WikiLeaks founder over a sexual assault investigation dating back to 2010.

The ruling by the Uppsala District Court is a setback for prosecutors who were hoping to issue a European Arrest Warrant for Assange and request his extradition from the United Kingdom to Sweden.

The court agreed with prosecutors that Assange could pose a flight risk, but said detention would not be proportionate.

The Swedish rape investigation was the reason Assange spent almost seven years in self-imposed exile in London’s Ecuadorian Embassy. The WikiLeaks founder walked into the building in June 2012, shortly after losing a years-long extradition battle in the UK’s Supreme Court.

He remained there until April this year, when his dramatic arrest prompted Swedish prosecutors to reopen the investigation last month.

Assange’s lawyer, Per E Samuelson, said Monday that his client denied the accusations and also argued that detention would be disproportionate. He added that Assange “has always wanted to cooperate” with the investigation.

The rape allegation was one of four sexual assault accusations that Assange faced after his visit to Sweden in August 2010. The case has never moved beyond the investigation stage and Assange has not been charged with any crimes in the country.

In August 2015, the statute of limitations on three of the four allegations lapsed. Under Swedish law, any charges related to the fourth allegation of rape must be made by August 2020.

The probe into the alleged rape was suspended in 2017 as a result of Assange’s continued residence in the embassy.

On Monday the judge said that in order to finish the investigation, the prosecutors could issue a European Investigation Order, which would make it possible for them to interview Assange and conclude the inquiry.

The prosecutor said the investigation will continue but didn’t give any details about the next steps.

Since his arrest in April, Assange has been sentenced to nearly a year in a UK prison over bail violations stemming from when he first entered the Ecuadorian embassy.

He is also facing a US extradition request.

Assange was indicted in the United States on one count of conspiracy to commit computer intrusion. He was then charged with 17 counts under the Espionage Act for his role in receiving and publishing national defense information in concert with former Army intelligence analyst Chelsea Manning

The Swedish court’s decision means the US will not have to compete with Sweden over which extradition request is given priority.