WikiLeaks founder Julian Assange speaks to the media outside the Ecuador embassy in west London on August 19, 2012. REUTERS/Olivia Harris/Files

QUITO (Reuters) - Ecuador and Sweden have signed a pact that would allow WikiLeaks founder Julian Assange to be questioned by Swedish authorities at Ecuador’s embassy in London where he has been holed up for more than three years since facing sexual assault charges, the Quito government said.

The legal agreement was signed in the Ecuadorean capital after half a year of negotiations.

“It is, without doubt, an instrument that strengthens bilateral relations and will facilitate, for example, the fulfillment of judicial matters such as the questioning of Mr. Assange,” the foreign ministry said in a weekend statement.

Assange, 44, took refuge in the embassy building in June 2012 to avoid extradition to Sweden, where he is wanted for questioning over allegations of sexual assault and rape against two women in 2010. The Australian denies the accusations.

Assange says he fears Sweden will extradite him to the United States where he could be put on trial over WikiLeaks’ publication of classified military and diplomatic documents five years ago, one of the largest information leaks in U.S. history.

Britain, which has accused Ecuador of preventing the course of justice by allowing Assange to remain in its embassy in the upmarket central London area of Knightsbridge, welcomed the agreement.

“It is for the Swedish Prosecutor to decide how they now proceed with a legal case,” a spokeswoman for the British Foreign Office said.