"I don't know where to begin with thanking people for securing my release," Hedges said in a statement.

"I have not seen or read much of what has been written over the past few days but Dani tells me the support has been incredible."

She added: "I am so happy to have my Matt home. We are overjoyed and exhausted!

"Matt and I, as well as his family, really need some time to process everything that we have been through."

Welcome home Matt Hedges! The whole country is relieved and delighted to have you home. Thanks to @PatrickMoodyFCO and the FCO team in UAE for your tireless work behind the scenes to make today possible

A statement from the Ministry of Foreign Affairs said that the family of Hedges "appealed for clemency in a personal letter to President His Highness Sheikh Khalifa bin Zayed Al Nahyan.

"The Ministry of Presidential Affairs has subsequently announced that a Presidential Pardon has been issued with immediate effect," it said.

Britain's Foreign Secretary Jeremy Hunt welcomed the news, saying that while the British government did not agree with the conviction, he was pleased Hedges would walk free.

Fantastic news about Matthew Hedges.Although we didn’t agree with charges we are grateful to UAE govt for resolving issue speedily.But also a bittersweet moment as we remember Nazanin &other innocent ppl detained in Iran.Justice won’t be truly done until they too are safely home.

He was arrested on May 5 at Dubai International Airport after a two-week research visit, in which he is said to have asked questions about the UAE ruling families, their networks, classified information on the UAE military and the political role in Yemen.

The case became a political issue in the UK, with Prime Minister Theresa May and Mr Hunt making Hedges' situation a matter for diplomatic relations.

"The UAE is determined to protect its important strategic relationship with a key ally," said Abdullah Al Naqbi, head of the department of legal affairs at the Ministry of Foreign Affairs. "Officials from both countries have discussed the matter regularly over recent months."