Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

WASHINGTON — A British graduate student who was imprisoned last year by the United Arab Emirates said his case shows how the Gulf state tramples on civil rights and academic freedom despite its carefully crafted marketing efforts.

Matthew Hedges was detained for six months after a two-week research trip, and said he was threatened with torture and kept in solitary confinement for most of that time. The 31-year-old Ph.D. candidate from Durham University was sentenced to life in prison on espionage charges before he was pardoned and released in November. The British government and rights groups say there was no basis for the spying charges.

Hedges, whose research focused on the expanding power of the UAE's security services since the Arab Spring, said his experience should serve as a warning that scholars of any nationality face serious risks in the Emirates and that the government is increasingly aggressive about shutting down debate on a litany of taboo subjects.

With the Emirates introducing "Orwellian" laws, Hedges said "it has become clearer in the last year that any form of independent or critical thinking is now deemed a security threat to the state."

Matthew Hedges in New York on Jan. 17, 2019. Carlo Allegri / Reuters

While Saudi Arabia has faced international condemnation for the killing of Saudi writer Jamal Khashoggi, the Emirates' repressive methods have been mostly overlooked by the U.S., Britain and other foreign powers, he said.

"You can't let countries like the UAE go unpunished for the actions they take," Hedges told NBC News during a visit to Washington. "There has to be an acknowledgement of the problem."

The United Arab Emirates has conducted a years-long global charm offensive, donating generously to Western universities, charities and think tanks while portraying itself as an open society and a reliable ally in a volatile region.

In November, the same month the Emirati authorities sentenced Hedges to life in prison in a hearing that lasted less than five minutes, the country held a "World Tolerance Summit" in Dubai with participants from around the world.

"They spend unimaginable amounts of money on their public relations strategy. And it is working," said Hiba Zayadin of Human Rights Watch. "Most people believe that the UAE is this liberal oasis in the Middle East, but it's arguably one of the most totalitarian" states in the Gulf.

UAE citizens are subject to much harsher treatment, Zayadin said. A court in the Emirates sentenced Ahmed Mansoor, an Emirati human rights advocate, to 10 years in May for "defaming" the UAE on social media. An appeal of his case was rejected on Dec. 31.

A prominent Emirati academic who lectured at the Sorbonne's campus in Abu Dhabi, Nasser bin-Ghaith, received a 10-year sentence in March 2017 for criticism of the UAE and Egypt.

The UAE embassy in Washington declined requests for comment. UAE authorities have said the country's courts respect the rule of law.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The Emirati government says the conviction was the result of a legitimate legal proceeding and that Hedges was found guilty of spying. "His recruitment and progress within a foreign intelligence service was authenticated to the Court by UAE Intelligence Agencies," the country's foreign ministry said in a statement after the Briton was released.

For the sake of the Emirates' close relationship with Britain, the UAE president, Sheikh Khalifa bin Zayed Al Nahyan, issued a pardon to Hedges, the ministry said.

"It was always a UAE hope that this matter would be resolved through the common channels of our longstanding partnership," minister of state for foreign affairs, Anwar Gargash,said after the presidential pardon.

The State Department did not respond to requests for comment. The department, which would ordinarily be in a position to address NBC News's questions, is one of the agencies affected by the partial government shutdown and therefore is short on personnel.

Matthew Hedges gives a TV interview in New York on Jan. 17, 2019. Carlo Allegri / Reuters

Hedges' detention marked a rare moment of public friction between the Emirates and Britain, as the country's leaders enjoy friendly relations with Washington and European powers and have purchased billions of dollars worth of weapons from the United States, Britain and other governments.

The head of Britain's MI6 intelligence service, Alex Younger, has said he was "perplexed" by the jailing of Hedges. The spy chief said he"genuinely can't understand how our Emirati partners came to the conclusions they came to."

The UAE has come under a degree of scrutiny for its role in the Saudi-led military campaign in Yemen, with rights groups accusing the Saudis and Emiratis of contributing to a catastrophic humanitarian crisis and horrific civilian death toll.

Although Hedges was released eventually with a presidential pardon, he said he is fighting to get his name cleared with the help of the British government as he says he confessed to espionage charges under extreme duress.

After he was detained at Dubai airport in May as he was preparing to return to Britain, Hedges said he was immediately subjected to intense daily interrogations that lasted 12-15 hours.

"They started to threaten me, they asked me to spy and steal documents from the UK Foreign Office for the UAE," he said.

"I was told if I didn't confess I would be given life imprisonment, that I would be renditioned to an overseas military base, tortured and never seen again."

Hedges said his interrogators made contradictory accusations without evidence, alleging he was spying for the country's rival Qatar, or for Israel, or for Britain's intelligence service.

His detention caused academics at some British universities to question maintaining financial or educational ties to the United Arab Emirates.

Staff at Britain's Birmingham University called for a boycott of a new campus that the school recently opened in Dubai, saying the university could not guarantee academic freedom for scholars at the UAE branch. Hedges' Durham University suspended all field research in the UAE, and lecturers at the University of Exeter, where Hedges previously studied, voted for an academic boycott and called on the school to suspend business arrangements with the country.

But other universities had a more muted response to Hedges' detention.

Rights advocates, regional experts and academics say Western universities and think tanks, which have long-established and well-funded ties to the Emirates and other oil-rich Gulf states, provide a veneer of legitimacy to UAE authorities and are often reluctant to publicly call out the regime over its stifling of dissent.

Faculty members at New York University, which operates a campus in Abu Dhabi, lobbied the school's administration to issue a public statement on Hedges' detention, said Lauren Minsky, an assistant professor of history at NYU who worked for eight years at the Abu Dhabi campus.

Asked about the Hedges case, John Beckman, spokesman for New York University, said, "NYU's president has stated publicly that he had discussed the matter with senior officials in Abu Dhabi ahead of its resolution."

UAE authorities have barred some members of NYU's faculty from teaching at the Abu Dhabi campus or conducting research in the country, and have censored materials for classes, Minsky and other faculty members said.

But Beckman said scholarship is flourishing and academic freedom is operating fully at the Abu Dhabi campus.

"A guarantee of academic freedom was an indispensable premise of NYU opening a campus in Abu Dhabi; it remains a commitment between NYU and our Abu Dhabi partners," he said.

Gulf countries, including the United Arab Emirates, have provided more than two billion dollars in funding to American universities between 2012 to June 2018, according to U.S. Education Department data, first reported in the Financial Times. The UAE ranked third among the Gulf states, donating $213 million.

Hedges' experience should prompt U.S. universities to reconsider the effect of UAE money on scholarly work and academic independence, said Varsha Koduvayur, an analyst with the Foundation for Defense of Democracies, a conservative think tank.

"I think in the wake of the Hedges case, they are going to need to think through whether they are enabling UAE donations to set their own research agendas," she said.