Intelligence whistleblower Edward Snowden has written to the president of Ecuador praising his country's "bravery" in considering his request for political asylum, it has been revealed.
Mr Snowden, who leaked details of secret surveillance operations in the UK and US, fled to Hong Kong and then to Moscow after White House officials requested his extradition.
His disclosures over the surveillance activities of the UK's GCHQ and its American counterpart, the National Security Agency, have caused huge controversy.
His letter to president Rafael Correa, written in Spanish, was leaked to the Press Association by sources in the Ecuadorian capital Quito.
Mr Snowden accuses the US government of a "grave violation" of human rights and of "unwarranted spying against innocent people".
The letter reads:
There are few world leaders who would risk standing for the human rights of an individual against the most powerful government on earth, and the bravery of Ecuador and its people is an example to the world.
I must express my deep respect for your principles and sincere thanks for your government's action in considering my request for political asylum.
The government of the United States of America has built the world's largest system of surveillance. This global system affects every human life touched by technology; recording, analysing, and passing secret judgment over each member of the international public.
It is a grave violation of our universal human rights when a political system perpetuates automatic, pervasive and unwarranted spying against innocent people.
In accordance with this belief, I revealed this programme to my country and the world. While the public has cried out support of my shining a light on this secret system of injustice, the government of the United States of America responded with an extrajudicial man-hunt costing me my family, my freedom to travel and my right to live peacefully without fear of illegal aggression.
As I face this persecution, there has been silence from governments afraid of the United States government and their threats. Ecuador however, rose to stand and defend the human right to seek asylum.
The decisive action of your consul in London, Fidel Narvaez, guaranteed my rights would be protected upon departing Hong Kong - I could never have risked travel without that. Now, as a result, and through the continued support of your government, I remain free and able to publish information that serves the public interest.
No matter how many more days my life contains, I remain dedicated to the fight for justice in this unequal world. If any of those days ahead realise a contribution to the common good, the world will have the principles of Ecuador to thank.
Please accept my gratitude on behalf of your government and the people of the Republic of Ecuador, as well as my great personal admiration of your commitment to doing what is right rather than what is rewarding. Edward Joseph Snowden.