Iran authorities weigh response to Tehran attacks
Iranians woke up to a new reality on Thursday after their capital, Tehran, suffered its deadliest militant attack in almost three decades.
Many have taken to social media to share their shock and offer condolences, and the hashtag #TehranAttacks has been trending on Twitter.
For Iranians under 30, who make up more than half of the population, it was a huge shock to see a suicide bomber and gunmen attack two of the most important buildings in Tehran - the parliament building and the mausoleum of Ayatollah Ruhollah Khomeini, the founder of the Islamic Republic.
But for their parents' generation this will all seem very familiar.
In the first decade after the 1979 revolution, Tehran experienced frequent gun attacks, bombings and hijackings as groups opposed to Iran's new religious rulers waged a bloody campaign of violence with the aim of overthrowing them.
Thousands were killed, and many suffered life-changing injuries - including the current Supreme Leader, Ali Khamenei, who lost the use of his right arm following a bomb attack in 1981.
By the 1990s the violence had subsided - partly as a result of a crackdown on dissent and thousands of executions - but a major legacy of those times is a culture of very strict security in public buildings and airports enforced by the Revolutionary Guards across the country.
While there have been sporadic attacks by armed groups from Iran's restive Kurdish and Sunni minorities in remote parts of the country, Tehran and most other big cities have seen no major incidents for years.
Most Iranians have therefore become accustomed to relative peace and quiet, and to being insulated from the violence plaguing neighbouring countries.
But Wednesday's attacks, which have been claimed by the Sunni jihadist group Islamic State (IS), challenged those assumptions.
Many in Iran are asking how armed men managed to penetrate the several layers of security around the parliament complex, which is on a major road running through central Tehran.
It seems that the militants, some of whom dressed in the all-enveloping chadors worn by women, made it as far as the metal detectors at the entrance to the parliament building then opened fire at guards and other visitors before storming into the building and targeting people at random.
It is likely that, behind the scenes, the Revolutionary Guards responsible for the security of the building will now be reviewing procedures and asking if more could have been done to prevent what seems to have been a significant security failure.
But publicly, the authorities will seek to reassure people by playing down the attacks.
Ayatollah Khamenei dismissed the attackers as "terrorists fumbling with fire-crackers".
Coverage of the attacks on state television was relatively low-key and stressed how quickly the security forces dealt with the attackers.
Security was not noticeably tightened on the streets of Tehran on Thursday and the message from the country's leaders was that it was very much business as usual.
The challenge for the leaders domestically will be to stop more people questioning Iran's military involvement in the conflicts in Iraq and Syria.
Iranians have been repeatedly told that the mounting losses their country is suffering abroad are a sacrifice worth making in order to prevent attacks at home.
After Wednesday, for some people the assertion may no longer ring quite so true.
But supporters of the campaigns in Syria and Iraq have also been taking to social media to say the Tehran attacks show why they are necessary.
And some observers point out that the violence on the streets of Tehran could actually be used to justify stepping up the campaigns.
Revolutionary Guards commanders issued a strongly-worded statement promising to "avenge every drop of innocent blood spilt" in the attacks and noting that they happened soon after a meeting between US President Donald Trump and Saudi Arabia's "backward leaders who support terrorists".
But is there a chance they could go beyond the rhetoric? Most observers believe it is unlikely that they would do anything to further escalate tensions with the Saudis.
President Hassan Rouhani, a moderate, also issued a message of defiance, saying the attacks would make Iranians more united in their determination to fight what he called "regional terrorism, extremism and violence".
But his opponents have sought to gain political advantage from the incident.
Supporters of Ebrahim Raisi, a hardline cleric who came second in last month's presidential election, said it was a consequence of Mr Rouhani weakening the country in his attempts to pursue better relations with the US and its Saudi allies.
Investigations into the attacks are continuing, and with several suspects now under arrest it is likely that more information will emerge in the coming days and weeks.
The authorities have already said the attackers were all Iranian citizens.
That could well lead to a crackdown on the country's Sunni minority communities, including the Baluchis, Kurds and Arabs.
Meanwhile in Tehran, as the funerals of the victims take place, the city's residents are thinking about security in a way they have not done for a long time.