Ecuador is hoping to work out a deal with Britain in order to remove WikiLeaks founder Julian Assange from their London embassy where he has been living for five years

Ecuador is working on finding a way for WikiLeaks founder Julian Assange to leave its London embassy after five years.

While the embassy stopped short of saying it wanted rid of Assange - who has infuriated Ecuador's president by criticising his political allies abroad - a veiled statement described the situation as 'untenable'.

The South American country is looking for a third-party mediator to help them work out a settlement with Britain regarding Assange, the foreign minister said on Tuesday.

Foreign Minister Maria Fernanda Espinosa said Ecuador is 'considering and exploring the possibility of mediation' to end the 'untenable' five-year stay.

'No solution will be achieved without international cooperation and the cooperation of the United Kingdom, which has also shown interest in seeking a way out,' she told foreign correspondents in Quito.

But Assange's legal team on Tuesday maintained he continued to be detained unlawfully.

A statement by Mr Assange's legal team said: 'The UN ruling, issued almost two years ago, is crystal clear in its language, Mr Assange is unlawfully and arbitrarily detained by the UK authorities and must be released.

'The UK should not permit itself to be intimidated by the Trump administration's public threats to "take down" Mr Assange.'

A Downing Street spokesman said: 'The Government of Ecuador knows that the way to resolve this issue is for Julian Assange to leave the embassy to face justice.'

Ecuadoran President Lenin Moreno (left, pictured with his chief adviser Andres Mideros) has been infuriated by Assange's criticism of his political allies abroad

The move by Ecuador comes a few months after its president Lenin Moreno warned Assange to avoid inflammatory political statements and commenting on issues involving the country's allies.

Assange spoke out in support for the Catalan separatists movement, which saw Moreno, who has been president of Ecuador since January, ask Assange to stay out of the Spanish crisis.

The WikiLeaks founder has been living in the Ecuadorian embassy in London for five and a half years after being granted political asylum as he fought sex related claims in Sweden.

Swedish prosecutors have now dropped their investigation into the allegations, but Mr Assange fears he will be extradited to the United States if he leaves the building and that there is a sealed indictment ordering his arrest.

Assange responded to Moreno on Twitter and accused him of attempting to silence him.

'If President Moreno wants to gag my reporting of human rights abuses in Spain he should say so explicitly--together with the legal basis,' he said.

The president has previously publicly pledged to uphold the activist's asylum 'as long as we assume his life may be in danger', but has also dismissed Assange as a 'hacker'.

Assange moved into Ecuador's embassy in London five years ago to avoid arrest over charges of rape and sexual assault in Sweden.

The charges were dropped by Swedish prosecutors in May 2017, though Assange remains in the embassy.

However, he still faces arrest by British police for violating the terms of his 2012 bail.

He has said that he needs to stay at the embassy due to fears he will be extradited to the United States and put on trial for WikiLeaks publishing leaked secret US documents.

It is the first time Ecuador has proposed mediation to resolve the case.