Ecuador and Sweden have reached a legal agreement that paves the way for WikiLeaks founder Julian Assange to be questioned by Swedish authorities at the Ecuadorian embassy in London where Assange took refuge three years ago to avoid being extradited to Sweden.

The Ecuadorian Foreign Affairs Ministry said the two countries reached an agreement on "legal assistance in criminal affairs as a result of the negotiations which started last June," according to CNN. "The agreement guarantees, among other things, the application and respect of the national legislation and principles of international rights, particularly those related to human rights, and the full exercise of national sovereignty, in any case of legal assistance between Ecuador and Sweden."

Swedish police want to speak with Australian-born Assange, 44, over an allegation of "lesser-degree rape," which Assange denies and says is politically driven by the U.S. While on a trip to the country in August 2010, Assange had consensual relations with a Swedish woman and then later, as they shared a bed, he had unprotected sex with her while she was asleep. She woke up concerned that he wasn't wearing protection, as she had repeatedly asked him to do earlier in the night, yet "felt it was too late" to stop the sex at that point and allowed Assange to continue, according to Wired.

The woman denied that Assange raped her, and no charges have been brought, but Swedish police have insisted that Assange travel to Sweden so they can move forward with a "preliminary investigation" and question him.

Assange fears that Swedish officials are using the investigation as a pretext to extradite him to the U.S., where he could face espionage charges and the death penalty for publishing classified government data. Ecuador granted Assange political asylum in June 2012 and he has been living in the embassy ever since. If he leaves, he will be arrested by British police and extradited to Sweden for questioning, according to The Independent.

In 2010, WikiLeaks published hundreds of thousands of classified government documents, including a video showing American soldiers in Iraq killing innocent civilians, which were leaked to the organization by former Army soldier Chelsea Manning.