The June 7 terror attacks in Tehran, executed by the Islamic State of Iraq and the Levant (ISIL, also known as ISIS), were a major landmark in Iran's history of dealing with terrorism. The last time Iran had witnessed an assault of this scope and significance in its capital city was in the early 1980s, when armed opponents of the Islamic Republic assassinated its key figures and sympathisers in an attempt to topple the nascent revolutionary regime.
Significantly, last week's ISIL attacks targeted two chief symbolic components of what has come to be known as the "Islamic Republic" - Ayatollah Khomeini's mausoleum and the Iranian parliament building.
Iran has long been fighting against ISIL in Iraq and Syria. However, unlike many Western and Middle Eastern countries, Iran had not faced any ISIL attacks within its borders until the attack on Wednesday, and questions abound as to how and why such a security breach occurred now.
The assailants - who were all reportedly from Sunni minority groups and had been battle-hardened in Mosul and Raqqa - approached a public entrance of the parliament with limited security control while reportedly disguising themselves as hijab-clad women.
They entered the building after shooting the security guard, but did not manage to go into the Majlis floor, where MPs were holding a session, either because of miscalculation or the slain officer's resistance. All four suspects targeting the parliament, and the two others who orchestrated a similar attack at the Khomeini shrine were killed. This outcome should not surprise us, particularly if we consider the "over one hundred" terrorist attempts thwarted by Iranian security forces "in the past couple of years", according to Iran's intelligence minister Mahmoud Alavi.
So it is possible to say that the ISIL attack was not caused by a major operational failure by the security forces, but there were some bare facts that made Iran susceptible to such an attack.
There are aggrieved religious and ethnic minorities living in Iran's border areas - particularly Kurds in the northwest, Arabs in the south and Baluchis in the southeast - who have long been discriminated against and neglected by the central government, making them amenable to militancy. The country needs an effective counterterrorism strategy that takes this reality into account in order to stop similar attacks from happening again.
Following the ISIL attack, the hardline opponents of Rouhani are expected to pursue a more aggressive approach to regional affairs and ramp up Iran's controversial presence and support for proxy groups in conflict theatres such as Syria, Iraq and Yemen.
Yet, the incident may have not transpired, not least at this particular moment, absent a number of external contributing factors. Less than a day before the attack, Saudi Foreign Minister Adel al-Jubeir declared in a meeting in Paris that Iran must be penalised for interfering in the region and espousing terrorist groups such as al-Qaeda. More importantly, the Saudi defence minister Mohammed bin Salman Al Saud had pointed out in an early May interview that Riyadh would try to take the fight inside Iran. Add to this the recent surge in border clashes in Iran's northwestern and southeastern provinces - which have left a number of military and law enforcement officers dead - and one cannot help connecting the dots.
Indeed, Saudi Arabia's newly found aggressiveness, first directed at Iran and more recently at Qatar, which is emboldened by its closer ties to the US under the hawkish Trump administration, has further destabilised the Middle East and galvanised terrorist elements into action.
Political Implications at home and abroad
Much as the June 7 terror attacks reinvigorated Iranians' sense of patriotism and thus had a unifying impact on the state and society, they were also a blow to the newly re-elected government of moderate President Hassan Rouhani and his "moderation project" at home and "engagement policy" abroad.
Hours into the incident and while it was still under way, the Persian-speaking social media was flooded with hardliner posts scorning or otherwise bashing the administration over its "soft" approach to international relations and pursuit of detente and rapprochement with the outside world, particularly with Iran's regional nemeses.
Internally, the hardliner groups - who are still reeling from last month's historic electoral defeat - will likely use this attack to strengthen their weakened political position and push for further "securitisation" of the domestic sphere. This so-called securitisation wave could include attempts by the mainly unelected parts of the state to curtail the government's plans to institutionalise citizenship rights and certain civil liberties and foster greater religious and political freedom in the country.
The hardliner groups' strong reaction received an unmistakable stamp of approval from Ayatollah Khamenei shortly after the attack. In an address later on the day, the supreme leader railed against the Rouhani administration, encouraging his frustrated followers to act as figurative "fire-at-will soldiers" and ordering them to open "fire" at their own discretion, whenever they witness a malfunctioning at the "central organs".
Similarly in the foreign policy sphere, following the ISIL attack the hardline opponents of Rouhani are expected to pursue a more aggressive approach to regional affairs and ramp up Iran's controversial presence and support for proxy groups in conflict theatres such as Syria, Iraq and Yemen. Pertinently, in its official statement after the terror attack, the Islamic Revolution Guards Corps (IRGC) pointed the finger of blame at the United States and Saudi Arabia, vowing "revenge" against the attack's perpetrators and their backers.
Unless and until cooler heads prevail in the regional capitals, attacks like the one that targeted Tehran will continue to usher in an increasingly aggravating spiral of hostility and further destabilise the Middle East.
Maysam Behravesh is a PhD candidate in the Department of Political Science and an affiliated researcher in the Center for Middle Eastern Studies (CMES), at Lund University, Sweden.
The views expressed in this article are the author's own and do not necessarily reflect Al Jazeera's editorial policy.