The pardoning of a British student sentenced to life imprisonment in the United Arab Emirates (UAE) for spying has been welcomed by the UK government. But the balance of power between the countries is changing.
The imprisonment of Matthew Hedges posed a real dilemma for the UK.
It had to decide whether to stand up to the UAE, a country with which it does £15bn of trade, or cave in and risk the perception that it is now the junior partner in the relationship.
Its strong response - and the fact Mr Hedges can now return home - is testament to the UK's diplomatic weight; this time the UAE flinched.
But the UAE's continued insistence that the Durham PhD student is "100% a secret service operative" - a claim Mr Hedges denies - marks a significant shift after a century of UK supremacy in the countries' relationship.
A clear danger
The UAE is clearly not Iran, which continues to detain UK nationals on similar charges including Nazanin Zaghari-Ratcliffe; it is a close and trusted partner.
But in the case of Mr Hedges, the UK has been reminded that the UAE's de facto leader, Abu Dhabi's Crown Prince Mohammed bin Zayed al-Nahyan (MBZ), is no pushover. He is used to getting his own way.
Unlike his counterpart in Saudi Arabia, Crown Prince Mohammed bin Salman (MBS), MBZ is a strategic thinker. He has stayed very close to US President Donald Trump, but has also developed his relationship with both Russia and China.
The UK is in danger of losing its favoured status in the UAE unless it can demonstrate that it is both a useful and reliable ally.
There are deep historical ties between the UK and the families governing the seven emirates, but the nature of the relationship has changed over the years.
The economic power that came with the the arrival of oil money has allowed the UAE's leaders to build new military and economic relationships.
Today, it remains the case that a defining principle of the relationship with the UK is that Britain - along with the US and France - guarantees the UAE's security against external and internal threats.
But Abu Dhabi has come to doubt the integrity of such promises following the overthrow of another US ally - former Egyptian President Hosni Mubarak in 2011.
As a result, it has begun to move away from its dependency upon Western powers.
The Crown Prince has watched Russia's intervention in Syria and has come to admire the willingness of Moscow to stick with its ally through thick and thin.
He has contrasted this with the positions adopted by the US and UK during the Arab uprisings; it seems he has never forgiven them for working with the elected Muslim Brotherhood government in Cairo.
At the same time, Abu Dhabi has drawn lessons from former US President Barack Obama's failure to enforce his "red lines" over the Syrian government's use of chemical weapons.
In the event that the UAE faces a major security threat, MBZ is concerned that the US or UK would drag their feet before responding - intervention is no longer in vogue.
This has had a profound impact upon how he views traditional and new partners.
Hence, MBZ will have wanted to test London's resolve around the case of Mr Hedges and he knows that Theresa May's government is under significant pressure, particularly as it looks for new trade deals to strike after Brexit.
Arguably, the balance in the relationship has now reached equilibrium and the UK needs the UAE more than ever before.
Brands and beaches
Indeed, there is a lot at stake.
The UAE is the UK's largest export market in the Middle East and its fourth largest export market outside the EU.
The UK exported £9.8bn of goods and services in 2016, which marked a 37% increase from 2009.
There are more than 5,000 British companies operating in the UAE, including BP, Shell, Rolls-Royce, BAE Systems, Mott MacDonald, Serco, Standard Chartered, HSBC and John Lewis.
More than 779 commercial agencies and 4,762 British brands have invested in the UAE.
It has also been reported that UK arms exports to the UAE rose last year by 94% to £260m, a figure that does not take into account bumper sales of cyber-security support.
Moreover, the UAE is not only an important market for the UK, but also a popular tourist destination visited by more than 1.25 million British tourists in 2016.
It is also home to 120,000 British residents, whose livelihoods and way of life will be put at risk if the relationship between the two countries is damaged beyond repair.
Mr Hedges' case has been a real test of nerve for both governments and while the UAE may have issued a pardon, there is no guarantee that MBZ will blink in any future dispute.
About this piece
This analysis piece was commissioned by the BBC from an expert working for an outside organisation.
Chatham House, the Royal Institute of International Affairs, describes itself as an independent policy institute helping to build a sustainably secure, prosperous and just world.
Edited by Duncan Walker