In the latest phase of the US-Iran confrontation, who came out on top is not clear-cut; both countries made gains and losses from the crisis and some of its the results are still to come.

By ordering the assassination on 3 January of general Qassem Soleimani, the head of Quds Force, the external arm of Iran’s Revolutionary Guards, President Trump claims to have eliminated a terrorist mastermind and all-round anti-American monster. In practice, Soleimani had started making mistakes, notably in using extreme violence to quell protesters demanding reform in Iraq, thereby alienating much of the majority Shia community that was previously favourable to Iran.

Operationally, the Iranian state loses little from the elimination of its most famous general who has become a religious and nationalist martyr, enabling the Iranian leadership to rally popular support against the US and US-imposed sanctions. Vast crowds supportive of the government have replaced protesters on the streets of Tehran and other cities.

Trump does gain from his willingness to order the killing of Soleimani, the senior Iranian security official orchestrating the Iranian campaign of limited attacks on US allies that escalated dramatically last summer. While seeking to retain deniability, Iran was clearly behind the harassment of shipping in the Gulf and, above all, the drone and missile strikes on Saudi oil facilities in September. The US had been weakened in the Middle East by Trump’s lack of response to these attacks and unwillingness to defend allies. The conviction had grown that he would never risk a war. The killing of Soleimani shows that he is.

The Iranian ballistic missile strikes on two US bases in Iraq, Erbil in Kurdistan and al-Asad in the western desert, were clearly symbolic, pre-announced and geared not to hurt anybody. Significantly, the US did not, so far as it is known, try to shoot the missiles down or retaliate. Iran sent multiple messages through third parties that this was the beginning and end of their military retaliation for the death of Soleimani.

US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Show all 35 1 /35 US airstrike kills Iran's Qassem Soleimani: Fallout in pictures US airstrike kills Iran's Qassem Soleimani: Fallout in pictures This photo released by the Iraqi Prime Minister Press Office shows a burning vehicle at the Baghdad International Airport following an airstrike in Baghdad, Iraq, early Friday 3 January AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures The wreckage of the car in which general Soleimani was travelling when a targeted US airstrike struck outside Baghdad International Airport on 3 January Ahmad Al Mukhtar via Reuters US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Demonstrators burn the US and British flags during a protest in Tehran after general Soleimani was killed in a targeted airstrike by American forces Reuters US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A burning vehicle at the Baghdad International Airport following an airstrike. The Pentagon said Thursday that the US military has killed general Qassem Soleimani, the head of Iran's elite Quds Force, at the direction of Donald Trump AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Protesters burn Israeli and US flags as thousands of Iranians take to the streets to mourn the death of general Soleimani at the hands of America EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Supporters of Donald Trump pray at an 'Evangelicals for Trump' campaign event held on the day following the killing of general Soleimani. At the event, the president praised the "flawless strike that eliminated the terrorist ringleader" AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A huge procession of mourners gather in Baghdad for the funeral of general Soleimani on 4 January AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Thousands of Iranians take to the streets to mourn the death of Soleimani during an anti-US demonstration to condemn the killing of Soleimani, after Friday prayers in Tehran, Iran EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iraqis perform a mourning prayer for slain major general Qasem Soleimani of the Iranian Revolutionary Guards at the Great Mosque of Kufa AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A billboard reading 'Death to America and Israel', installed by Iran-backed shiite armed groups at a street in Jadriyah district in Baghdad, Iraq EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A handout picture provided by the office of Iran's supreme leader Ayatollah Ali Khamenei shows him visiting the family of Soleiman KHAMENEI.IR/AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Thousands of Iranians take to the streets in Tehran EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Pakistani Shiite Muslims burn a mock of a US flag as they hold pictures of General Qasem Soleimani during a protest against the USA, outside the US Consulate in Lahore, Pakistan EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iran's Ambassador to Lebanon Mohammed Jalal Feiruznia, looks to a portrait of Soleimani, as he receives condolences at the Iranian embassy, in Beirut, Lebanon AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures People make their way on the street while a screen on the wall of a cinema shows a portrait Soleimani in Tehran AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Aziz Asmar, one of two Syrian painters who completed a mural following the killing of Iranian Revolutionary Guards commander Qasem Soleimani poses next to his creation in the rebel-held Syrian town of Dana in the northwestern province of Idlib AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A demonstration in Tehran AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures An anti-US demonstration to condemn the killing of Soleimani, after Friday prayers in Tehran EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Mujtaba al-Husseini, the representative of Iran's supreme leader Ayatollah Ali Khamenei, delivers a speech in the holy shrine city of Najaf AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Pakistani Shiite Muslims burn a mock of a US and Israeli flags as they hold pictures of General Qasem Soleimani during a protest against the USA, outside the US Consulate in Lahore, Pakistan EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Protesters demonstrate in Tehran AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Pakistani Shi'ite Muslims hold pictures of General Qasem Soleimani during a protest against the USA, in Peshawar, Pakistan EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Protesters, holding a photograph of the leader of the People's Mujahedin of Iran Massoud Rajavi, outside Downing Street in London PA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Protesters burn a US flag in Tehran AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A Syrian man offers sweets to children to mark the killing AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iranian worshippers attend a mourning prayer for Soleimani in Iran's capital Tehran AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Kashmiri Shiite Muslims shout anti American and anti Israel slogans during a protest AP US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iranian worshipers chant slogans during Friday prayers Reuters US airstrike kills Iran's Qassem Soleimani: Fallout in pictures A protest against the USA, in Islamabad, Pakistan EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iranians burn a US flag in Tehran EPA US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Supporters of the National Council of Resistance of Iran in Germany (NWRI) protest outside Iran's embassy in Berlin, Germany Reuters US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Supporters of the National Council of Resistance of Iran in Germany (NWRI) protest outside Iran's embassy in Berlin Reuters US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iranian worshippers in Tehran AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Vehicles of the United Nations Interim Forces in Lebanon (UNIFIL) patrol a road in the southern Lebanese town of Kfar Kila near the border with Israel. Following morning's killing of Major General Qasem Soleimani, Lebanon's Iran-backed Hezbollah movement called for the missile strike by Israel's closest ally, to be avenged AFP via Getty US airstrike kills Iran's Qassem Soleimani: Fallout in pictures Iranian women take to the streets in Tehran EPA

The US insisted that this assurance must include Iranian proxy forces, such as pro-Iranian paramilitary groups in Iraq, who have been ordered not to target American forces, according to the Pentagon. The rush of attacks by pro-Iran forces on US or US allies predicted by many commentators is unlikely to occur, at least in the short term.

This is a military gain for the US: devastating attacks on the US or US allies carried out by shadowy but Iranian-linked perpetrators have long been a feature of Iran’s way of making war. This supposedly gave Iran deniability, but the tactic has been used so often that Iranian culpability was glaringly obvious. Post-Soleimani, it is beginning to look outdated as a military method.

Iranian prestige was certainly dented by the ease with which the US killed its general. On the other hand, the willingness of the US to allow Iran to fire its missiles at its bases and not to retaliate shows that Trump takes Iran seriously and really does not want a war, if he can avoid it. The millions of Iranians in the streets to mourn Soleimani may help dent the credibility of hawks and neo-conservatives, who have claimed that the Iranian regime is about to founder.

Iraq will continue to be the main arena where the US-Iran confrontation is fought out. This has always been in Iran’s interest because it has far more power in Iraq than the US. This influence was being sapped by the increasingly anti-Iranian tone of the mass protests that began last October. If these ebb because of the changed political situation, this will be an important political gain for Iran.

Trump is increasing sanctions on Iran in response to its missile attack, however ineffective and ritualised it may have been. If these sanctions seriously affect Iraq, which buys many things such as gas and electricity from Iran, this is bad news for Iraqis, but it will take time for it to become clear whom they blame.

As for the 5,200 US troops in Iraq, Iran and its local allies say they want them out, but many Iraqi leaders would like to keep them as a guard against a revived Isis and a counterpoise to Iran. For all the Iranian rhetoric about cleansing the Middle East of US forces, the presence of isolated detachments of US soldiers in Iraq provides Iran with an easy target in any renewed crisis.