Stockholm’s appeal court has rejected a demand by Julian Assange’s lawyers to lift the arrest warrant against him, leaving the WikiLeaks founder still facing extradition to Sweden should he renounce his asylum in Ecuador’s London embassy.

“In making this assessment, account must be taken of the fact that Julian Assange is suspected of crimes of a relatively serious nature,” the court said in a statement on Thursday. A Swedish prosecutor first sought Assange’s arrest four years ago following sexual assault and rape allegations, which he denies.

“There is a great risk that he will flee and thereby evade legal proceedings if the detention order is set aside. In the view of the court of appeal, these circumstances mean that the reasons for detention still outweigh the intrusion or other detriment entailed by the detention order.”

But the court also noted that Sweden’s investigation into Assange had come to a halt and prosecutors’ failure to examine alternative avenues of investigation “is not in line with their obligation – in the interests of everyone concerned – to move the preliminary investigation forward”. The ruling is expected to put pressure on prosecutors to find new ways to break the deadlock.

Per Samuelsson, one of Assange’s lawyers in Stockholm, said the court’s criticism of the prosecutor was aimed at her refusal to come to London to question Assange.

“This is crucial because the court said we were right in the wording, but not in the court’s actual decision,” he said.

After the ruling he had spoken to Assange, who was disappointed but confident that they would prevail in the long run.

“Swedish and international law is on our side,” Samuelsson said. “The ruling shows we are on the right track, but unfortunately the court of appeal did not have the courage to overturn the arrest warrant.”

Asked what he meant by the need to pursue “alternative avenues” of investigation, Niclas Wågnert, the appeal court judge in the case, told the TT news agency: “That’s a matter for the prosecutor. One way would be to interrogate him in London.”

Following a rejection of their demands by a lower court in July, Assange’s lawyers argued in submissions to the appeal court that a European arrest warrant issued in November 2010 was being employed as a “coercive measure” against him because it could not be carried out, thereby condemning him to “deprivation of liberty” in order to exercise his right to asylum.

The submission said that, rather than explore possible avenues to break the deadlock, the prosecutor had “violated the principles of consideration urgency, and effectiveness” by refusing to interview Assange in the Ecuadorian embassy and “hiding behind the arrest warrant” as an excuse.

Britain’s Foreign Office said last month it would “actively welcome” a request by the prosecutor to question Assange inside the embassy and would “do absolutely everything to facilitate” such a move.

The appeal court also rejected a demand from Assange’s lawyers for the prosecutor to hand over 200 text messages sent by the WikiLeaks founder’s accusers around the time of his alleged crimes.

Assange has always claimed he is innocent and that he would be prepared to face a Swedish court were it not for a threat that he would be extradited to the US for political crimes. Neither the US nor Swedish governments have responded to his requests for guarantees. Assange has not been charged with any crime, but is being investigated over allegations of rape and sexual molestation.

In response to the appeal, the Swedish prosecutors in the case, Marianne Ny and Ingrid Isgren, said they accepted there was “a temporary obstacle” to executing the arrest warrant, but that it was nonetheless essential to prevent Assange from evading justice. His presence in the Ecuadorian embassy was voluntary and so did not constitute a deprivation of liberty, they said, thereby nullifying defence arguments about disproportionality.

The text messages contained sensitive information about the two women in the case, they said, and information had previously leaked on to the internet and led to the women being harassed. There were, therefore, “grave reasons” to protect the messages, the prosecutors said.

Legal opinion in Sweden is sharply divided on the case, with some arguing that the deadlock must be broken, principally by the prosecutors travelling to London to interview Assange. Politicians are reluctant to be seen to put pressure on prosecutors, while public opinion has wearied of the case.

Mats Larsson, a columnist for Expressen, Sweden’s largest tabloid, argued last month: “Everyone is tired of the Assange circus … it is high time it was resolved.”