Today Iran’s supreme leader Ali Khamenei gave his first Friday sermon in Tehran for eight years to an audience of thousands, as he tried to calm down the furious public reaction to the Revolutionary Guards mistakenly shooting down a Ukrainian plane carrying 176 passengers, then proceeding to lie about their responsibility for three days.

Khameinei spoke of the “cowardly” killing of General Qassem Soleimani by the US, of President Trump using the destruction of the plane to “push a poison dagger” into the backs of the Iranian people. Rhetorical flourishes like this are not going do him a lot of good with critics who see the shootdown as epitomising the incompetence, duplicity and division of his government.

But the nature of the crisis differs markedly from the way it is being portrayed abroad. For more has gone wrong than a series of blunders. Obscured amid the plaudits and denunciations directed at Soleimani and Khamenei is the fact that both men’s policies in the Middle East had become counterproductive.

Over the last four years, Iran has had great success in spreading its influence in countries with large Shia populations. But it has failed to consolidate the status quo it played such a large role in creating. “The Iranians are good at gathering cards, but not at playing them,” is an old saying in the region.

Despite Iranian successes in Iraq, Syria and Lebanon, the power structure in all three countries is rickety and prone to crises. Over the last four months, Iraq, Lebanon and Iran have been rocked by mass protest, while Syria is in the final throes of civil war.

Protests in Iran over downing of plane and tensions with the west Show all 23 1 /23 Protests in Iran over downing of plane and tensions with the west Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranian police officers take position while protesters gather in front of Amir Kabir University AP Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranians demonstrate following a tribute for the victims of the Ukraine Boeing 737 crash in front of the Amirkabir University in the capital Tehran EPA Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranian police dispersed students chanting "radical" slogans during a gathering in Tehran to honour the 176 people killed when an airliner was mistakenly shot down AFP via Getty Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University - People hold flowers as tear gas fired by police rises Online videos purported to show that Iranian security forces fired both live ammunition and tear gas to disperse demonstrators protesting against the Islamic Republic's initial denial that it shot down a Ukrainian jetliner AP Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranian police officers take position while protesters gather AP Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University AFP correspondents said hundreds of students had gathered early in the evening to pay respects to those killed in the air disaster ISNA/AFP via Getty Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranian protester prepares to throw a tear gas canister back at police AP Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University A protester confronts an Iranian police officer AP Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University epa08120223 Iranians protest to show their sympathy with victims of Ukraine International Airlines Boeing 737-800 in front of the Amir Kabir University in Tehran, Iran, 11 January 2020. Media reported that hundreds of Iranians protests in Tehran in solidarity with victims of the Ukraine plane as Iranian military released a statement claiming that Ukraine International Airlines flight PS752 was shot down due to human error. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranian police officers take position while protesters gathe AP Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University Iranians light candles for victims EPA Protests in Iran over downing of plane and tensions with the west Anti-government protest at Amirkabir University epa08120526 Iranians protest to show their sympathy to victims of Ukraine International Airlines Boeing 737-800 in front of the Amir Kabir University in Tehran, Iran, 11 January 2020. The Iranian military released a statement on 11 January 2020 that Ukraine International Airlines flight PS752 was shot down due to 'human error.' The passemger jet en route from Tehran to Kiev crashed minutes after takeoff on 08 January 2020, all all 167 passengers and nine crew members aboard were killed. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran People burn British and Israeli flags during a protest in front of the British embassy, in Tehran. Hundreds of Iranian hardliners gathered for a protest against Britain, a day after the UK ambassador to Iran Robert Macaire was detained after attending a a vigil for the victims of Ukraine passenger jet EPA Protests in Iran over downing of plane and tensions with the west British embassy protestBritish embassy protest in Tehran Chanting "Death to Britain", up to 200 protesters rallied outside the mission a day after the brief arrest of British ambassador Rob Macaire AFP via Getty Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran epa08122502 Iranian hardliners shout slogans as they gather in front of the British embassy during an anti-Britain protest, in Tehran, Iran, 12 January 2020. According to reports, hundreds of Iranian hardliners gathered for a protest against Britain, a day after the UK ambassador to Iran Robert Macaire was detained after attending a a vigil for the victims of Ukraine passenger jet. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran Iranian demonstrators hold placards bearing the images of slain military commander Qasem Soleimani and Iran's Supreme Leader Ayatollah Ali Khamenei in front of the British embassy in the capital Tehran on January 12, 2020 following the British ambassador's arrest for allegedly attending an illegal demonstration. - Chanting "Death to Britain", up to 200 protesters rallied outside the mission a day after the brief arrest of British ambassador Rob Macaire at a memorial for those killed when a Ukraine airliner was shot down. (Photo by ATTA KENARE / AFP) (Photo by ATTA KENARE/AFP via Getty Images) ATTA KENARE AFP via Getty Images Protests in Iran over downing of plane and tensions with the west Protesters chant slogans and hold up posters of Gen. Qassem Soleimani while burning representations of British and Israeli flags, during a demonstration in front of the British Embassy in Tehran, Iran, Sunday, Jan. 12, 2020. A candlelight ceremony late Saturday in Tehran turned into a protest, with hundreds of people chanting against the country's leaders â€” including Supreme Leader Ayatollah Ali Khamenei â€” and police dispersing them with tear gas. Police briefly detained the British ambassador to Iran, Rob Macaire, who said he went to the Saturday vigil without knowing it would turn into a protest. (AP Photo/Ebrahim Noroozi) Ebrahim Noroozi AP Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran epa08122741 Iranian hardliners gather in front of the British embassy during an anti-Britain protest, in Tehran, Iran, 12 January 2020. According to reports, hundreds of Iranian hardliners gathered for a protest against Britain, a day after the UK ambassador to Iran Robert Macaire was detained after attending a a vigil for the victims of Ukraine passenger jet. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west A hardline protester holds up a placard during a demonstration in front of the British Embassy in Tehran, Iran, Sunday, Jan. 12, 2020. A candlelight ceremony late Saturday in Tehran turned into a protest, with hundreds of people chanting against the country's leaders â€” including Supreme Leader Ayatollah Ali Khamenei â€” and police dispersing them with tear gas. Police briefly detained the British ambassador to Iran, Rob Macaire, who said he went to the Saturday vigil without knowing it would turn into a protest. (AP Photo/Ebrahim Noroozi) Ebrahim Noroozi AP Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran epa08122743 Iranian hardliners gather in front of the British embassy during an anti-Britain protest, in Tehran, Iran, 12 January 2020. According to reports, hundreds of Iranian hardliners gathered for a protest against Britain, a day after the UK ambassador to Iran Robert Macaire was detained after attending a a vigil for the victims of Ukraine passenger jet. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran epa08122745 Iranian hardliners gather in front of the British embassy during an anti-Britain protest, in Tehran, Iran, 12 January 2020. According to reports, hundreds of Iranian hardliners gathered for a protest against Britain, a day after the UK ambassador to Iran Robert Macaire was detained after attending a a vigil for the victims of Ukraine passenger jet. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west British embassy protest in Tehran epa08122786 Iranian hardliners gather in front of the British embassy during an anti-Britain protest, in Tehran, Iran, 12 January 2020. According to reports, hundreds of Iranian hardliners gathered for a protest against Britain, a day after the UK ambassador to Iran Robert Macaire was detained after attending a a vigil for the victims of Ukraine passenger jet. EPA/ABEDIN TAHERKENAREH ABEDIN TAHERKENAREH EPA Protests in Iran over downing of plane and tensions with the west Protesters chant slogans while holding up posters of Gen. Qassem Soleimani during a demonstration in front of the British Embassy in Tehran, Iran, Sunday, Jan. 12, 2020. AP

Much depends on how the Iranian leadership responds in the next few months to the assassination of Soleimani, formerly their high-profile viceroy overseeing the Iranian zone of influence. They could continue to head towards a full scale US-Iran conflict or, just possibly, veer towards some sort of compromise deal.

Neither side wants a war, as demonstrated by America’s belated revelation that 11 of its soldiers were injured by the Iranian ballistic missile strike on two of its bases in Iraq on 8 January. At the time, Trump had reassured the world that there were no American casualties. and therefore no need for him to retaliate. Meanwhile, Iranian paramilitaries in Iraq have been instructed not to attack US facilities in order to de-escalate the crisis.

In the longer term, if Iran continues with the policies pursued by Soleimani and Khamenei, it will feel compelled to resume low-intensity warfare to provide a counterbalance to US sanctions. Before this happens, Iran will have to decide if it is going to use the elimination of Soleimani to devise a new strategies to replace those that have failed.

Iran's Supreme Leader Ayatollah Ali Khamenei weeps at Soleimani prayers

Nobody watches the changing political winds in Tehran as closely as Iraqis, who know that their country is where the US-Iran struggle is being fought out.

“Iran is in a very critical position,” says a prominent Iraqi Shia politician in Baghdad quoted in the online magazine Middle East Eye. “The policy that Khamenei previously pursued in managing the Iraq file and the region is no longer successful. The Iranian Revolutionary Guard had contributed to creating problems in Iraq that turned into a burden for Iran and became an obstacle in the way of its negotiations with the United States.”

Discussions now taking place in Iran are about whether the Revolutionary Guards should retain the Iraq file, or be handed over to some other body, such as intelligence or the foreign ministry. Soleimani’s former deputy and nominated successor as head of the Quds Force, Esmael Ghaani, has been handling Afghanistan, and is less familiar with the Middle East.

Quite aside from US pressure for disengagement, it is very much in Iran’s interests in Iraq to take a less hands-on role, and to look to the Iraqi government and Shia political parties to drive out the US. In Syria, where Iran had orchestrated support for President Bashar al-Assad after 2011, an Iranian pullback is feasible, because Assad has largely won the war to stay in power, and since 2015, the leading role in supporting him has been taken over by Russia.

Given these developments, it should be easier than it looks for Tehran and Washington to reach agreement on reducing Iran’s regional activism. The problem is that in Middle Eastern politics, everybody tends to overplay their hand at one time or another, usually when they come to overconfidently believe that they can put their opponent permanently out of business. The US has repeatedly fallen into this trap in Afghanistan, Iraq and Syria – and it is all too likely to do the same in its confrontation with Iran which, whatever the two sides’ intentions, will remain a dangerous stalemate, always at risk of tipping into outright war.

US announces new sanctions against Iran

The US maximalist demands on Iran’s nuclear facilities, ballistic missiles and regional influence effectively mean that it wants regime change or capitulation. Both outcomes are possible; neither is likely. The Iranian leadership tends to come together when threatened, and is prepared to use any degree of force to stay in power. Western capitals have been looking expectantly for an end to the clerical regime in Tehran since the overthrow of the Shah in 1979 – but to no avail.