After the US assassination of Qassem Soleimani and Iran's missile attacks against US forces in Iraq, attention has been focused on the extent of the Iranian response — will there be further retaliation?
Further complicating the situation is Iran's surprise admission that its own military shot down a Ukranian jetliner over Iranian airspace in the thick of the military emergency.
Iran faces severe domestic and international criticism over its handling of the communications and investigations after the crash.
Fresh protests against the government and its incompetence over the downing of the commercial flight are roiling the streets of Tehran.
Elsewhere in the Middle East, Iran may not be able to rein in years of pent up anger by many who blame the region's woes on years of Iranian meddling and violence by pro-Iranian militias (much of it orchestrated and controlled by Soleimani himself). This anger has not been fully papered over by recent US actions.
Activists in Syria and Iraq have made calls over social media to mobilise for additional protests.
Yet Iran has been particularly adept at peering through the fog of war and working through these setbacks.
By focusing on Iran's mistakes, we risk losing sight of how its leaders could use this crisis as an opportunity to further its long term goals
As the old saying goes, "never let a good crisis go to waste", and Iran certainly hasn't before.
How Iran responds will not be merely for "retaliation" but for securing its long term interests.
Iran has three strategic goals
Despite previously facing similar setbacks in its long term conflict with the US, the Islamic Republic of Iran has demonstrated a coherent vision and patiently pursued three strategic objectives: regime preservation, establishing itself as the regional hegemon and eliminating the US presence from the region.
The Supreme Council has been disciplined enough over the decades to work through crises and setbacks that might get in the way of these goals.
A good example is how Iran turned a crisis into an opportunity following 9/11.
At the time Iran's leadership feared that after the US invasion of Iraq and the overthrow of Saddam Hussein, Iran and the Supreme Council would be next.
Attempts to start talks with the US failed. Instead Iran was labelled part of the "axis of evil" by US President George W Bush.
But Iran did not retaliate and instead adeptly used the US's subsequent missteps in Iraq to its advantage and patiently expanded its influence in Iraq while the US debated withdrawal.
The assassination of Soleimani is a similar crisis point for Iran and it also offers opportunities Iran will not want to squander.
And new opportunities to achieve them
Firstly, Soleimani's assassination took place on Iraqi soil. This has threatened the US-Iraq relationship.
US-Iraqi military cooperation against remnants of the Islamic State have been suspended, the Iraqi Parliament has voted on a resolution to end the presence of US troops in the country and Iraqi society is on hyper alert for further US attacks on its sovereignty.
Soleimani's killing has furthered one of Iran's key objectives: limiting US influence and military presence in Iraq.
Any Iranian further response will not jeopardise this easy win.
Soleimani's killing also presents a fresh opportunity for Iran to divert growing dissatisfaction with Iranian influence in Iraq.
Ongoing anti-Iranian protests in Iraq are overshadowed by the US attack. The strike against Soleimani has splintered the Iraqi protesters' focus on Iran, to now include the US.
Secondly, Iran's leader, Ayatollah Ali Khamenei, and the Supreme Council, can use Soleimani's killing to deflect domestic protests against the regime and instead strengthen regime preservation.
Their ability to do this has been challenged by the inadvertent downing of the passenger jet and subsequent protests, but the Iranian government is betting that by admitting its mistake, it can also point to the Trump administrations recklessness as the first cause and that they could spin this to have the US burden more of the blame.
The Iranian government has also survived even bigger protests in 2009 and squashed the Green Movement without making significant concessions.
Thirdly, Soleimani's killing injects a fresh shot of chaos in an already unstable region.
Throughout the decades, Iran has routinely and successfully exploited chaotic political conditions expand influence throughout the region via a proxy network of armed militias.
These militias operate in Iraq, Syria, and Lebanon as well as Yemen and Afghanistan.
In Iraq and in Syria, Iran has taken advantage of the chaos caused by Islamic State to bolster its proxy militia network as part of the formal national security structures of those countries.
And finally, the Soleimani strike has given Iran a pretext to withdraw from conditions of the Iran nuclear deal.
Iran's leaders have recently announced they are no longer bound by limits on uranium enrichment, the number of centrifuges installed and operated, uranium stockpiles, and research and development pertaining to enrichment.
Having done so as a response to the Soleimani killing, Iran understands this makes it all the more difficult for European countries to pressure it into abiding by the terms of the Joint Comprehensive Plan Of Action (JCPOA).
US, not Iran, looks erratic now
Washington and the West have long questioned whether Iran is a rational actor, often portraying it as country controlled by a regime of "mad mullahs" intent on destroying the US and Israel.
Yet the rational actor question has been upended after the Soleimani's killing and instead been turned towards the US.
US President Donald Trump is a notoriously unpredictable. Under his administration the usual US foreign policy and national security decision making processes have broken down.
Confusing statements after Soleimani's killing demonstrate a lack of coherent policy towards Iran, and suggests second order effects, like Iraq's response, were not properly considered.
US policy towards Iran may be particularly erratic under Trump, but it has never been especially cohesive under previous administrations.
It would be wrong to assume that Iranian regime is in total control of its destiny.
Iran after all is surrounded by US military installations, is outgunned by any conventional measure and the US has a network of allies, including Australia, that they could call upon to respond to further Iranian aggression.
Additionally, while Iran has been able to control protests, there is still significant underlying discontent within Iran that continually threatens to boil over.
However, the ever-shrinking desire within the US on all sides of the political spectrum to drag the US into another Middle Eastern war, means that Iran still has a lot of room to manoeuvre.