Abu Dhabi, United Arab Emirates CNN  — 

British academic Matthew Hedges, who was sentenced to life in prison for spying in the United Arab Emirates, has been pardoned with immediate effect.

He was released from prison Monday and will leave the country later in the day, a UAE official told CNN.

Hedges, 31, was sentenced on Thursday after a five-minute hearing. A family spokeswoman said Hedges was forced to sign a confession in Arabic, a language Hedges does not read nor speak.

Before announcing his pardon, authorities in Abu Dhabi showed journalists video that purportedly showed Hedges confessing to being a spy, though it’s unclear if the statement was made under duress.

Hedges, a specialist in Middle Eastern studies at the University of Durham, was arrested on May 5 at Dubai airport, following a research trip. He went on to spend almost six months in solitary confinement.

Matthew Hedges, a specialist in Middle Eastern studies at the University of Durham, was arrested on May 5 at Dubai airport.

Despite issuing Hedges’ pardon, the Emiratis continue to allege that he was a spy recruited by British intelligence due to his network of sources inside the country.

The UAE claimed that Hedges used his academic work as a cover to enter the country for espionage, a claim British authorities have denied.

The 31-year-old was granted a presidential pardon following a request for clemency from his family and in consideration of “the historical relationship and close ties between the UAE and the UK,” Jaber al-Lamki of the UAE National Media Council said Monday.

He is one of 785 prisoners being pardoned as part of the UAE’s forthcoming national day celebration on December 2.

The British national will be allowed to leave the country as soon as the paperwork regarding his pardon is processed, officials said.

Hedges’ wife, Daniela Tejada, said in a statement that Hedges’ pardon was “the best news we could have received.”

 Daniela Tejada, the wife of British academic Matthew Hedges.

“Our six-plus months of nightmare are finally over and to say we are elated is an understatement,” Tejada said.

“That he is returning home to me and the rest of his family is much more than I was ever expecting to happen this week.”

UAE Foreign Affairs Minister Anwar Gargash said in a statement that Hedges’ pardon will allow both sides “to return our focus to the underlying fundamental strength of the UAE UK bi-lateral relationship and its importance to the international community.”

UK ‘deeply perplexed’ how this happened

Hedges’ imprisonment had taken a toll on London’s relationship with Abu Dhabi. British Foreign Secretary Jeremy Hunt previously called the case “unacceptable” and warned of “serious diplomatic consequences.”

A spokesman for UK Prime Minister, Theresa May, said Monday that the government “welcomed” Hedges’ pardon although “we didn’t agree with the charges.”

“But we are grateful to the UAE government for resolving the issue,” the spokesman added.

Hunt told reporters on Monday that Abu Dhabi’s Crown Prince Sheik Mohammed bin Zayed and its foreign minister, Sheikh Abdullah bin Zayed recognized “the importance of the strategic relationship between the UK and the UAE” and worked “very, very hard to try and resolve this situation.”

However, Hunt added: “But, the truth is that we should have never have got to here and we are deeply perplexed as to how it happened.”

The foreign secretary reiterated that the UK had not seen any evidence to support the spy accusations against Hedges.

Hedges' wife, Daniela Tejada, said that his pardon was the end of their "six-plus months of nightmare."

Detained in Dubai – a UK-based legal advice group – said that while it was good news that Hedges has been released, it was “far from an optimal resolution.”

Chief Executive Radha Stirling said in a statement: “Matthew should never have been arrested; never should have been forced to sign a false confession in Arabic; never should have been locked up in solitary confinement for six months … and most certainly never should have been sentenced to life imprisonment.

“The pardon does not undo any of that, and indeed, Matthew’s innocence has not been admitted by the UAE; the wrongs done to him have not been acknowledged,” she added.

UAE continues to allege that Hedges was a spy

Despite his release, the UAE continues to assert that Hedges was guilty of espionage. The Emiratis said the five-minute hearing was a sentencing hearing, and that Hedges had three separate hearings prior to that.

Hedges’ pardon came after reporters in Abu Dhabi were shown grainy video of him confessing to being an officer for MI6, Britain’s intelligence agency, and admitting to gathering information on the Emirati military, its key industries and key government figures using his academic credentials as a guise.

One piece of evidence used in court was a video in which Hedges was asked his rank in MI6. He replies “captain,” despite the fact that there is no such thing as a captain – or any military rank – in MI6.

In another video, Hedges is seen in an interrogation room with two Emirati officials. In English he said he was an MI6 analyst, not a field officer in charge of recruiting spies, but then later went on to say he was in fact trying to develop assets in the Middle Eastern nation using his PhD research as a cover.

“The case against Mr. Hedges was predicated on evidence secured from Mr. Hedges electronic devices; surveillance and intelligence gathering by UAE intelligence and security agencies; and evidence provided by Mr. Hedges himself – including a corroborated account of asset recruitment and training and the confidential information being targeted,” the UAE said in its statement.

Jaber al-Lamki of the UAE National Media Council announced Hedges' pardon.

Al-Lamki told reporters that a government investigation revealed that Hedges had previously worked in the UAE for the Institute for Near East and Gulf Military Analysis, (INEGMA), a strategy and security consultancy. UAE authorities allege that British intelligence recruited Hedges due to the network he cultivated while working for INEGMA.

Ben Bradshaw, the member of Parliament who represents Hedges’ constituency, told CNN last week that the British government and Durham University have assured UAE authorities that Hedges is not a spy.

Bradshaw called Hedges’ release “great news” in a tweet Monday.

“Let’s hope Matt’s home safe & sound with his wife Daniela soon. Thanks to everyone who has worked so hard for his release,” Bradshaw said.

The UAE also denied allegations that Hedges was mistreated in custody.

Al-Lamki told reporters Hedges was “accorded his full rights as a defendant” and provided a doctor twice a week, a translator and a defense lawyer paid for at the government’s expense.

CNN’s Bharati Naik contributed to this report