LONDON — A British academic was sentenced to life in prison on Wednesday in the United Arab Emirates on charges that he was spying for the U.K. — a verdict that Britain described as shocking as it urged its Mideast ally to reconsider the decision.

Matthew Hedges, a 31-year-old PhD student in Middle Eastern Studies at Durham University, was arrested at Dubai Airport on May 5 and has been held in detention since. He can challenge the ruling within 30 days.

Foreign Secretary Jeremy Hunt had travelled 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" and said the case would have consequences for bilateral relations.

Get Breaking News Delivered to Your Inbox

"I regret the fact that we have reached this position and I urge the UAE to reconsider," Hunt said.

The harsh verdict is unusual for a British national in the UAE who is not accused of a violent crime. Hedges' wife Daniela Tejada, who was in court, said she was in "complete shock."

"Matthew is innocent," she said. "The Foreign Office know 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 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 said police secured evidence of his activities from Hedges' electronic devices and surveillance by Emirati intelligence. Durham University, meanwhile, said that there was no reason to believe Hedges "was conducting anything other than legitimate academic research."

The emirates of Abu Dhabi and Dubai are home to large numbers of British nationals who work in a range of positions, from top management jobs and public relations to teaching and athletics. Ties between Britain and the seven emirates of the UAE run deep, dating back more than 200 years. The British were among the first contracted to help build the UAE's infrastructure after oil was discovered there in the early 1960s and retain a multimillion dollar arms trade.

The Muslim country on the eastern coast of the Arabian Peninsula prides itself on being tolerant of foreigners, and of being tourist-friendly. But British nationals have run afoul of local customs and laws, which prohibit public intoxication, kissing in public and cursing at someone — which can all lead to arrest and deportation.

Human Rights Watch said Hedges was detained at Dubai International Airport as he was preparing to leave the country following two weeks in the UAE. His wife said he was doing fieldwork for his doctoral thesis on the impact of Emirati security and foreign policies. The academic was charged after more than a month in detention, the group said.

"UAE rulers cannot claim to preside over a global knowledge and education hub while locking up academics for months in solitary confinement," Michael Page of Human Rights Watch said.