Ecuador has granted asylum to Wikileaks founder Julian Assange two months after he took refuge in its London embassy while fighting extradition from the UK.It said there were fears Mr Assange's human rights might be violated.
Foreign minister Ricardo Patino accused the UK of making an "open threat" to enter its embassy to arrest him.
Mr Assange took refuge at the embassy in June to avoid extradition to Sweden, where he faces questioning over assault and rape claims, which he denies.
The Foreign Office said the decision on Mr Assange's application for political asylum would not affect the UK's legal obligation to extradite him to Sweden.
It tweeted: "We remain committed to a negotiated solution that allows us to carry out our obligations under the Extradition Act."
But does his new status mean he can now leave his Swedish problems behind? No. Asylum does not equal immunity from prosecution - and Julian Assange needs safe passage through UK territory that he won't get.
Mr Assange knows he can't leave without risking arrest by officers waiting outside. The police can't enter the embassy unless the government revokes its status.
Embassy vehicles are protected by law from police searches - but how could he get into an Ecuadorian car without being apprehended? And what happens after he's in the car? At some point he will have to get out again. Stranger things have happened.
In 1984 there was an attempt to smuggle a Nigerian man from the UK in a so-called "diplomatic bag" protected from inspection. The bag was in fact a large crate - and customs officers successfully intercepted it at the airport.
The UK government will still seek to arrest him and it will not grant him safe passage. If he steps out, he will be arrested.Announcing Ecuador's decision, Mr Patino said the country believed Mr Assange's fears of political persecution were "legitimate".
He said the country was being loyal to its tradition of protecting those who were vulnerable.
"We trust that our friendship with the United Kingdom will remain intact," he added.
The announcement was watched live by Mr Assange and embassy staff in a link to a press conference from Quito.
Outside Ecuador's embassy in London, the BBC's James Robbins said news was slowly spreading through Mr Assange's assembled supporters and they were delighted.
"The political temperature has risen very significantly. It is clear this is only the beginning of a very long legal contest," he said.
And BBC legal correspondent Clive Coleman said there was now a "complete standoff" between the UK and Ecuador regarding the status of the embassy in London.
He said the British government now had to make a decision, adding that the risks were enormous - including making other embassies around the world vulnerable.
"I imagine the Foreign Office is awash with lawyers, discussing their options," said our correspondent.
"I would be very surprised if that power was used - certainly in the short term," he added.
Mr Assange entered the embassy after the UK's Supreme Court dismissed the Australian national's bid to reopen his appeal against extradition and gave him a two-week grace period before extradition proceedings could start.
A subsequent offer by Ecuador to allow Swedish investigators to interview Mr Assange inside the embassy was rejected.
The Wikileaks website Mr Assange founded published a mass of leaked diplomatic cables that embarrassed several governments, particularly the US's, in 2010.
Earlier, the UK Foreign Office warned it could lift the embassy's diplomatic status to fulfil a "legal obligation" to extradite the 41-year-old by using the Diplomatic and Consular Premises Act 1987.
That allows the UK to revoke the diplomatic status of an embassy on UK soil, which would potentially allow police to enter the building to arrest Mr Assange for breaching the terms of his bail.
Mr Assange says he fears that if extradited to Sweden, he will then be passed on to the American authorities.
In 2010, two female ex-Wikileaks volunteers accused Mr Assange, an Australian citizen, of committing sexual offences against them while he was in Stockholm to give a lecture.
Mr Assange claims the sex was consensual and the allegations are politically motivated.