It is barely 47 years old, not quite the size of Scotland, and buys nearly £250m of British-made weapons in a good year.

But, despite the long and often strong ties between the UK and the United Arab Emirates, the life sentence given this week to Matthew Hedges has brought differences between the two allies into sharp focus.

The British student was convicted by a court in Abu Dhabi – one of the seven monarchies that make up the United Arab Emirates – for allegedly spying on behalf of one of its closest allies, a decision that has left both Whitehall and Westminster scrambling for an explanation.

Play Video 1:07 'Not a fight I can win alone': wife of UK academic jailed in UAE – video

Throughout the five months Hedges spent in prison leading up to his trial, few in London thought it would come to this. Not only had the Emirates bought its weapons, they were also the region’s second largest buyer of British non-military exports, hosted more than 120,000 UK immigrants, and remained a long-established partner in security and intelligence matters.

Spats had been typically dealt with at a political level, not in public. Royal visits to Abu Dhabi, reciprocal trips to London and a consensus on most regional issues had kept the relationship near the top of Britain’s regional priorities, even as the war on Yemen, and the blockade on neighbouring Qatar, caused increasing political tensions at home.

Like its powerhouse neighbour, Saudi Arabia, the UAE has adopted a far more robust regional posture in the past two years. Both have moved from the shadows where they had historically preferred to operate, with the protection of Britain and the US, to become proactive, even belligerent, actors, no longer shy of the consequences of their actions.

Led by Crown Prince Mohammed bin Zayed, a figure described as “mercurial” by a former senior official, the Emirates have led the Yemeni war efforts, and been a standard bearer in the regional efforts to isolate Qatar. Both fronts are near a standstill, and facing growing condemnation from abroad. The pushback has been felt in the UAE, as have criticisms over human rights and labour laws, which have long been sore points for local officials.

Prince Mohammed, known locally as MbZ, has acted as a mentor for Saudi Arabia’s young and embattled crown prince, Mohammed bin Salman, during his rapid ascent to be heir to the throne. Both sides share a deep aversion to organised political Islam, and have formed an axis, along with Egypt’s leader, Abdel Fattah al-Sisi, which has pitched them against Doha, Turkey and what remains of the Egyptian Muslim Brotherhood that was ousted from government in Cairo in 2013 and has remained in exile in Turkey.

As their positions and posturing have hardened, so too has their distaste for foreign critiques. Donald Trump’s explicit statement that both allies would no longer hear US officials complaining about human rights, governance or corruption has been warmly received. And, according to both regional and western officials, Emirati and Saudi leaders have bristled at allies who have not followed Trump’s lead.

One former official said the Emirati crown prince, who is effectively the leader of the absolute monarchy, had a “scratchy” relationship with Britain. Despite being trained at Sandhurst military academy, and a regular visitor to London, his views of the UK remained chequered and very much coloured by his relationships with British leaders: ties to David Cameron were solid; to Theresa May, less so.

The prince has a former MI6 station chief in Abu Dhabi, Will Tricks, as one of his closest aides, and his ties to the Secret Intelligence Service have long been strong.

The state being free to label a British student a spy and sentence him to life in jail is at odds with this historical relationship, and would suggest either a breakdown, or the making of a political point.

The British assessment is that Emirati officials truly believed Hedges, who was researching Emirate tribal structures and their views on the war in Yemen, was indeed spying. But in better times, the executive would have stepped in before a public court case became an international incident.

Play Video 1:36 UAE ambassador defends prosecution of British academic – video

“They are likely feeling bruised over something,” a second former senior official said. “Probably Yemen. Saudi would be in there somewhere. This is them saying they matter and they’ll assert themselves. This will go away soon. But it’s a reminder that the relationship is not as strong as we think it might be. It’s a very different region in many ways, but it remains deeply driven by the strength of personal ties.”

• This article was amended on 27 November 2018. An earlier version said that the UAE “buys nearly £250bn of British-made weapons in a good year”. That figure should have been £250m.