A British Ph.D. student was sentenced to life in prison on Wednesday in the United Arab Emirates on charges that he was spying for the United Kingdom.

Matthew Hedges, 31, a doctoral student at Durham University, was arrested at Dubai’s airport on May 5 and has been held in detention since then. Hedges traveled to the UAE for a research trip to “interview sources about the country’s security policies,” the BBC reported.

The Federal Appeals Court of Abu Dhabi said Hedges was found guilty of "spying on the UAE and providing sensitive security and intelligence information to third parties." Local papers say police secured evidence of Hedges' activities from his electronic devices and surveillance collected by members of the Emirati intelligence. Durham University, meanwhile, said that there was no reason to believe Hedges "was conducting anything other than legitimate academic research."

BRITISH STUDENT HELD IN SOLITARY CONFINEMENT IN UAE AFTER BEING ACCUSED OF SPYING, REPORT SAYS

Hedges can challenge the ruling within 30 days. The BBC reported, citing an Abu Dhabi newspaper, that a “life sentence means a maximum of 25 years in jail.”

Foreign Secretary Jeremy Hunt had traveled to the UAE last week and discussed the case with Abu Dhabi Crown Prince Mohammed bin Zayed and Foreign Minister Abdullah bin Zayed. He described the situation as “unacceptable.”

"Today's verdict is not what we expect from a friend and trusted partner of the United Kingdom and runs contrary to earlier assurances," Hunt said in a statement which underscored his surprise at the decision.

British Prime Minister Theresa May said she was “deeply disappointed and concerned” about the decision.

“The Foreign Office will remain in close contact with Matthew, his family and his lawyer,” she said on Wednesday. “We will continue to do all we can to support them as they consider the next steps and we will continue to press this matter at the highest level with the Emiratis.”

BRITAIN’S SUPREME COURT RULES BAKERY DIDN’T DISCRIMINATE IN ‘GAY CAKE’ CASE

Hedges’ wife Daniela Tejada, who was in court, said she was in “complete shock.”

"Matthew is innocent," she said. "The Foreign Office knows this and have made it clear to the UAE authorities that Matthew is not a spy for them."

Urging the British government to make a stand for him, she added: "I am very scared for Matt. I don't know where they are taking him or what will happen now. Our nightmare has gotten even worse."

The Associated Press contributed to this report.