Facing a rising threat of terrorist attacks sponsored by Islamic State, Iran's government is trying to improve relations with the country's ethnic and religious minorities that have become a target for recruiting by the militant group.
Those populations, concentrated in far-flung provinces, have long been alienated politically and economically from the rest of the country.
But since terrorist attacks on June 7 killed 12 people and injured scores more in the capital, Tehran, the country's leaders have made them the focus of counter-terrorism efforts.
Officials said four of the five terrorists who carried out those attacks — which targeted the parliament building and the shrine of Ayatollah Ruhollah Khomeini — were Kurds from western Iran who had been recruited and radicalized by Islamic State.
Iran's Shiite-dominated government began paying closer attention to the minority communities in 2014, when Islamic State, who are Sunni extremists, rose to prominence.
The Ministry of Intelligence started scanning social media to identify Islamic State suspects in the country as President Hassan Rouhani tried to downplay religious differences, appointing a Sunni spiritual leader as his special assistant for ethnic and religious minorities to address underdevelopment in Sunni-majority areas.
In the wake of the June attacks, authorities have intensified their efforts, ramping up law enforcement patrols and intelligence gathering along Iran's border region where many Iranian Sunnis and Kurds live in destitute conditions.
Officials have also been increasingly forthcoming with the public about the fight against Islamic State inside the country. Last month authorities announced the arrest of 27 suspected Islamic State members who they said were hiding weapons and planning attacks in religious centers.
In response to Iran's crackdown, Islamist State militants have renewed calls for more bloodshed against Iran's Shiite majority, which the group views as apostates who should be killed.
In several videos it has released in Persian since its attacks in Tehran, the terrorist group calls on Iran's Sunnis to join its fighters in Syria and Iraq or carry out attacks in Iran.
One video released last month shows a masked Islamic State militant urging young Sunnis in Iran to leave the country to join the organization. Two days later, Islamic State released another video showing an Iranian Revolutionary Guard soldier being taken away in a truck near the Syria-Iraq border.
Iran has long been a focus of Islamic State propaganda because of its large Shiite population and military support for militiamen fighting the terrorist group in Syria and Iraq.
But until June, Islamic State had not been successful in carrying out an attack in Iran.
Its desire to do so is only increasing as it continues to lose territory in Iraq and Syria. The terrorist group has shifted its focus from building a caliphate to mobilizing its sympathizers to self-radicalize and launch attacks, experts said.
"They promised their audience they would be victorious in Iraq and Syria, but as they lose ground they've had to change their narrative," said Paul Salem, a research analyst at the Washington-based Middle East Institute. "Their new narrative is that they are taking the fight to the heart of Shiite power. This is new messaging in Islamic State's post-decline in Syria and Iraq."
Iran has said its support for groups fighting Islamic State was aimed at keeping the organization out of Iran. But experts said its involvement has damaged its standing with its own minorities.
About 8 million Iranians, or 9% of the country's population, are Sunnis, many living in underdeveloped areas, including the Sistan-Baluchistan province, which borders Pakistan. There are also about 6 million Kurds, the majority of whom live in Kurdish provinces in northwestern Iran.
Those areas are also home to several Sunni and Kurd extremist groups that for years have carried out attacks on the country's border region in an effort to call attention to the discrimination and lack of opportunities they face.
The populations there are most susceptible to radicalization and Islamic State's ideology, analysts said.
"Islamic State has tried to create an offshoot in Iran's provinces, specifically in the Kurdish region, and has tried to recruit people in border areas where there's a large Sunni population," said Ariane Tabatabai, an assistant professor of security studies at Georgetown University and an expert on the issue.
Experts said the country is now paying the price for continuing to neglect the minorities.
"When officials keep ignoring them there will be a few people within Iran's 8 million Sunnis who feel angry and agree to Islamic State's worldview," said Alex Vatanka, a senior fellow at the Middle East Institute. "Their recruitment to Islamic State is driven by socioeconomic grievances and those are people Iran shouldn't ignore and needs to bring back to the mainstream fold."
During his campaign for reelection this year, Rouhani promised to address grievances of the Sunni population. But after winning, he didn't appoint any Sunnis to his new Cabinet.
He faced widespread criticism from moderate pundits for failing to invite Molavi Abdul Hamid — a prominent Sunni spiritual leader who had helped the government in its outreach to the Sunni population — to his presidential inauguration.
"There is a gap between rhetoric and action on part of Iranian officials, which shows that they are either sectarian or incompetent," Vatanka said.