LONDON — Swedish prosecutors announced Tuesday that they were dropping an investigation into a 2010 rape allegation against WikiLeaks founder Julian Assange.

The decision was a victory for Assange, who has long maintained the sexual encounter was consensual and that he was innocent of the charges.

But the Swedish case was just one piece of Assange’s legal predicament.

He is in a British prison while he awaits a decision on an extradition request by the United States. The U.S. government wants him to stand trial for violations of the Espionage Act for his alleged role in obtaining and disseminating secret government documents relating to the wars in Iraq and Afghanistan.

Assange is fighting extradition — arguing that he acted as a publisher and journalist, and that the United States is pursuing him for “political offenses.”

The first substantive hearing on the extradition request is scheduled for February.

On Tuesday, Eva-Marie Persson, the deputy director of public prosecution in Sweden, said in a statement that the passage of time had weakened the rape case.

She said the accuser submitted a “credible and reliable version of events” and that her statements “have been coherent, extensive and detailed.”

But she concluded: “My overall assessment is that the evidential situation has been weakened to such an extent . . . that there is no longer any reason to continue the investigation.”

In 2010, Assange was accused of committing sexual offenses in Sweden. He sought refuge in the Ecuadoran Embassy in London in 2012, where he stayed for nearly seven years.

The Swedish case was abandoned once before, in 2017, in part because prosecutors said Assange could not be properly interviewed. It was reopened in May after Assange was forcibly evicted from the Ecuadoran Embassy and arrested by British police.

Kristinn Hrafnsson, editor in chief of WikiLeaks, said in a tweet that the focus should now shift to “the threat Mr Assange has been warning about for years: the belligerent prosecution of the United States and the threat it poses to the First Amendment.”

In June, Sajid Javed, then the home secretary, signed an extradition request from the United States, where Assange is wanted on 18 counts.

Assange’s attorneys have said their client acted only as a journalist and publisher, and they argue that he is protected by the First Amendment in the United States.

U.S. government officials assert Assange engaged in the explicit solicitation of classified materials and assisted in hacking a computer.

In the British courts, Assange’s attorneys will argue that Britain should block his extradition on the grounds that the U.S. prosecution is politically motivated and the charges against him amount to political offenses — two factors that by treaty could bar his handover.

In May, a United Nations official said Assange was showing symptoms of “prolonged exposure to psychological torture.” He is jailed in a protective wing of the London-area Belmarsh prison. Recently he has been granted access to a computer to assist in his defense against extradition, but his lawyers complained this week that he didn’t have Internet access to do research.