I ran and the United States appear to be easing tensions as both countries head into political volatile election years, with the threat of an armed conflict that seemed increasingly likely just months ago fading away.

A weekend exchange of detainees between Iran and the United States brokered by diplomats indicated ongoing back-channel discussions among regional and global powers attempting to resolve the standoff between the two countries.

“Thank you to Iran on a very fair negotiation,” US president Donald Trump wrote after the Swiss-brokered prisoner exchange in which US scholar Xiyue Wang was traded for Iranian cancer researcher Masoud Soleimani. “See, we can make a deal together!”

On Monday, Iran’s foreign minister Mohammad Javad Zarif said that Tehran was open to an even broader exchange of nationals held by the two countries.

“After getting our hostage back this week, fully ready for comprehensive prisoner exchange,” he wrote on Twitter. “The ball is in the US court.”

Analysts say prospects are exceedingly bleak for a broad deal between Tehran and the administration of Donald Trump over Iran’s pursuit of nuclear technology, its refinement of its missile programme, and its support for armed groups in the Middle East.

Tensions high as Trump approves new Iran sanctions: In pictures Show all 17 1 /17 Tensions high as Trump approves new Iran sanctions: In pictures Tensions high as Trump approves new Iran sanctions: In pictures Iran claims that in this picture released by Iran state TV, their surface-to-air missile is seen as it shoots down a US surveillance drone EPA Tensions high as Trump approves new Iran sanctions: In pictures This photo shows US RQ-4A Global Hawk unmanned surveillance drone. A drone of this model was shot down by Iran on Thursday 21 June AFP/Getty Tensions high as Trump approves new Iran sanctions: In pictures An oil tanker is on fire after it was subject to a suspected attacked at the Gulf of Oman on June 13. The US has blamed Iran for the attack Reuters Tensions high as Trump approves new Iran sanctions: In pictures Iran claims that in this picture released by Iran state TV, debris from the downed US drone is seen after it was recovered from Iranian waters AFP/Getty Tensions high as Trump approves new Iran sanctions: In pictures Smoke billows from an oil tanker after it was subject to a suspected attacked at the Gulf of Oman on June 13 Reuters Tensions high as Trump approves new Iran sanctions: In pictures US President Trump holds up a signed executive order to increase sanctions on Iran on 24 June AP Tensions high as Trump approves new Iran sanctions: In pictures Iranian President Rouhani stated in a televised address that the White House is "afflicted by mental retardation" following the increase in sanctions on 25 June EPA Tensions high as Trump approves new Iran sanctions: In pictures An Iranian navy boat tackles the fire on the Norwegian owned Front Altair oil tanker after it was hit in a suspected attack AFP/Getty Tensions high as Trump approves new Iran sanctions: In pictures Iran claims that in this picture released by Iran state TV, debris from the downed US drone is seen after it was recovered from Iranian waters AFP/Getty Tensions high as Trump approves new Iran sanctions: In pictures Smoke billows from an oil tanker after it was subject to a suspected attacked at the Gulf of Oman on June 13 Reuters Tensions high as Trump approves new Iran sanctions: In pictures A screenshot from a video released by the US Department of Defense that the US claims to show Iranian removing an unexploded limpet mine form the hull of the Japan-owned ship that was attacked in the Gulf of Oman on June 13 Getty Tensions high as Trump approves new Iran sanctions: In pictures An item reportedly found on the Japan-owned oil tanker that was attacked on June 13 in the Gulf of Oman AFP/Getty Tensions high as Trump approves new Iran sanctions: In pictures A handout photograph from the US Department of Defense shows a composite material that the US claim was left behind on the hull of the Japan-owned oil tanker following the removal of an unexploded limpet mine Getty Tensions high as Trump approves new Iran sanctions: In pictures A view from the cabin of an Iranian navy boat as it tackles the fire on the Norwegian owned Front Altair oil tanker after it was hit in a suspected attack EPA Tensions high as Trump approves new Iran sanctions: In pictures Release by US government A picture released by U.S. Central Command shows damage to the hull of the oil tanker Kokuka Courageous. The picture suggests that the ship is 'likely' to have been hit by a mine as the US Secretary of State Mike Pompeo moves to blame Iran for the suspected attack Reuters Tensions high as Trump approves new Iran sanctions: In pictures Smoke billows from an oil tanker after it was subject to a suspected attacked at the Gulf of Oman on June 13 Reuters Tensions high as Trump approves new Iran sanctions: In pictures Release by US government A picture released by U.S. Central Command shows damage to the hull of the oil tanker Kokuka Courageous. The pictures suggests that the ship is 'likely' to have been hit by a mine as the US Secretary of State Mike Pompeo moves to blame Iran for the suspected attack EPA

Still the weekend prisoner exchange, as well as diplomatic manoeuvres in Europe, Asia and the Middle East, suggest an improvement in relations from just a few months ago, and a diminishing possibility of armed conflict.

“It’s difficult to say because the Americans are not sharing anything with us, but there’s clearly a motive to calm things down,” said a western diplomat whose brief includes Iran.

Esfandyar Batmanghelidj, an Iran analyst based in London, said: “The big question marks for me is whether this good bit of news on the prisoner exchange is something that happened to come to fruition after a year of discussion or whether the larger political environment played a role.”

Iran and the US earlier this year appeared locked in an escalating confrontation. Washington stepped up its campaign of “maximum pressure” targeting Iran’s economy and Tehran allegedly launched a series of attacks on US allies in the Middle East.

Diplomats and analysts say worried US allies in the Arabian Peninsula, particularly the rulers of Oman and the United Arab Emirates, played key roles in cooling down temperatures.

A shift towards accommodation with Iran in recent months by the UAE, a federation of seven monarchies with differing relations to Tehran, has also significantly lowered White House appetite for confrontation, said the western diplomat.

“The UAE played a key role in this regard by saying to the US to calm down and that they won’t join any kinetic action against Iran a few weeks ago,” they added.

Theodore Karasik, a researcher at Gulf State Analytics, said the UAE “wants to lessen the Iranian pressure so it can focus on Libya”, where it is backing warlord Khalifa Haftar in an armed offensive against the UN-brokered authority in Tripoli.

“[Libya] is target number one right now,” he said.

Analysts say that despite recent protest violence over price hikes in Iran in which at least 230 people have been killed, Tehran has concluded that it can ride out the US economic pressure.

Mr Batmanghelidj, whose research firm Bourse & Bazaar focuses on Iran’s economy, said he has detected a number of fiscal positive signs, even as the country weathers a deep recession. The Iranian currency has stabilised, even as it is severely weakened; inflation growth has slowed; manufacturing activity has started to expand after contracting; and both the services and manufacturing sectors are adding employment.

In addition, if Iran manages to distribute savings after reducing fuel subsidies - the move that sparked the recent violently suppressed protests in the first place - the purchasing power of the country’s poorest will be improved, said Mr Batmanghelidj.

Xiyue Wang, right, with Brian Hook, the US representative for Iran, at an airport in Zurich, Switzerland, following his release from jail in Iran as part of a prisoner swap (AP)

Iran also can boast some diplomatic successes which put it in a less confrontational mood. On Friday in Vienna, instead of a stormy session of nuclear deal participants over Iran’s recent alleged breaches of the 2015 agreement that the US had violated, all parties re-affirmed their support for the settlement, while China and Russia blamed Washington for Tehran’s moves.

Meanwhile a European financial instrument called Instex, intended to evade US sanctions on Iran, is being rolled out. Last week, Belgium, Denmark, Finland, Netherlands, Norway and Sweden joined the UK, France and Germany as shareholders, suggesting the barter mechanism was catching on.

Iran is also coming up to 2020 parliamentary and 2021 presidential elections that will increase the machinations of the political elite and give voice to rising economic discontent. The country hardly needs an international confrontation with the US.

On Monday, Iran’s president Hassan Rouhani described diplomatic negotiations as “necessary and revolutionary”, ahead of a high-profile state visit later this month to Japan, which has also served as intermediary between Washington and Tehran.

The Trump administration, too, finds itself compelled to show something for its hardline Iran policy as the polarised US enters closely watched 2020 presidential and congressional elections that will be shadowed by ongoing impeachment proceedings.

Goaded by Washington hardliners intent for years on stoking confrontation with Iran, the Trump administration launched a pressure campaign that backed itself into a corner, forced either to launch an armed conflict, back down on sanctions and make a deal, or go into 2020 elections with Iran hanging over it as a foreign policy flop.