Azerbaijan’s government is growing increasingly concerned about what it sees as growing Iranian manipulation of the country’s Shia Muslim believers.

Azerbaijan’s security services recently presented senior government officials with a report describing how Iran has “increased its capabilities in Azerbaijan’s regions,” one analyst close to the government told Eurasianet.org. “Many more people are now under Iran’s influence, and this has sounded alarm bells inside the government,” the source said, speaking on condition of anonymity.

In 2013, Azerbaijan relaxed restrictions, in effect an informal ban, on religious figures linked to Iran on preaching in public. This tactical embrace of Shiism was aimed at stemming the flow of Azerbaijanis joining ISIS and fighting in Syria and Iraq, a trend that Baku believed was inspired by a rise in hardline Sunni tendencies.

But now it appears the policy is having unintended consequences, resulting in what authorities believe is increased control by Iran over Shia practice in Azerbaijan. According to official data, 22 of the 150 Shia madrassas in the country are “under the control of Iran,” wrote Kenan Rovshanoglu in a recent report for the Azerbaijani news agency Turan.

Many secular Azerbaijanis have been alarmed by the increasing visibility of Shia practices in the country. During the Ashura celebrations in September in Baku, some children participated in the ritual, which involves self-flagellation. “When I saw children, who do not have a real understanding of religion, wearing hijab and attending Ashura ceremonies, I thought they are going to become kamikazes to be sent in the future to Syria,” said MP Zahid Oruc.

In response, in early October, the State Committee for Family, Women and Children Affairs of Azerbaijan proposed legislation that would prohibit children from taking part in Ashura commemorations and similar religious rituals. The legislation has not yet been voted on.

Iran’s Supreme Leader, Ayatollah Ali Khamenei, appeared to publicly criticize the proposed law during a November meeting with Azerbaijan President Ilham Aliyev in Tehran. “We should appreciate this great opportunity and the glorious mourning ceremonies of the Shiites in Azerbaijan, because they will strengthen the identity of Azerbaijan’s nation and country,” Khamenei said.

Azerbaijan, however, has been wary of publicly calling out Tehran. The two countries have had uneasy relations since Azerbaijan gained independence in 1991, as Baku fears Iran’s religious influence and Tehran is concerned about Azerbaijan’s potential influence over the large ethnic Azeri population in northern Iran. Each also has close ties to the other’s biggest enemy: Azerbaijan with Israel, and Iran with Armenia.

Since President Hassan Rouhani’s coming to power in 2013, Iran has been forced to recalibrate its relations with Azerbaijan. Official bilateral contact has increased dramatically since then, with the two sides signing more than 20 cooperation agreements in the economic sphere.

In one project that would have been unimaginable before 2013, Azerbaijan has provided a loan to build a 100-mile stretch of a railroad in Iran, from the Azerbaijani border to the city of Rasht, part of the North-South Transport Corridor. Baku hopes that the initiative can derail plans to develop rail links between Iran and Armenia.

The government has not publicly claimed that Iran influenced the Ashura commemorations, but one official, Deputy Chairman of the State Committee for Work with Religious Organizations Gunduz Ismayilov, pointedly said that “there are some forces in Azerbaijan who seek to bring political elements into Ashura commemorations in the country.”

In early December, the government-connected website Haqqin.Az published an article accusing Iran of trying to recruit Shia pilgrims visiting the holy city of Karbala in Iraq. The article claimed that 30,000 Azerbaijanis visited Karbala for Ashura this year, an increase of 33 percent over the previous year.

The article also alleged that the Iranian Islamic Revolutionary Guard and its associated Shiite militia, “Hasdi Shabi,” have recruited Azerbaijanis to gather intelligence and conduct anti-government propaganda against Baku. Some of the propaganda, the article claimed, was focused on Nardaran, a center of Shia conservativism in Azerbaijan.

In 2015, security services carried out a series of raids in Nardaran, arresting religious activists they accused of plotting to overthrow the government. Azerbaijan’s authorities also believed that Nardaran’s religious leaders were under Iranian influence, and that after the operation, that influence has been curbed. The Iranian propaganda, the Haqqin article said, criticized the Nardaran events as an “infringement of rights and persecution of Shias.”

Some in Baku question the government’s focus on Iran’s influence over it Shia. “It would be too easy to claim that all the people who went to Iraq for holy visits end up under Iran’s influence,” one mid-level government official told EurasiaNet.org on condition of anonymity. The official added, though, that “falling under the influences of foreign intelligence is much easier there than anywhere else.”

The official suggested that more Azerbaijanis visiting Iraq and Syria are recruited by ISIS: The number of Azerbaijanis joining ISIS has been on the rise in the last two years, and last year 151 people were stripped of their Azerbaijani citizenship for fighting in the ranks of terrorist organizations. “This is the main threat,” the official said.

Another article, by a government think tank, the Center for Strategic Studies (SAM), also appeared to speak to Baku’s concerns about Iran, this time about its relations with Armenia.

The unsigned article raised eyebrows among Baku’s foreign policy community, both for its tone – reading more like an official statement than a piece of analysis – and its language. It was published in Azerbaijani, instead of Russian and English, suggesting the topic wasn’t SAM’s usual international audience, but a message to the Iranian government via its embassy in Baku.

The piece criticized increasing contacts between Tehran and the de facto authorities of Nagorno Karabakh, whom Baku regards as a separatist regime on Azerbaijani territory. It described recent appearances of Karabakh officials in the Iranian media and the publication of two books on Karabakh. And it highlighted a November 15 conference in Iran devoted to Karabakh. “The Iranian International Studies Association, one of the founders of which is the Iranian Foreign Minister Mohammad Javad Zarifi, has created a kind of platform for the conduct of anti-Azerbaijani propaganda by Armenian scientists,” the author wrote.

While Azerbaijani criticism of Iran-Armenia relations is not new, it appears to have reached a new level, one analyst with close links to the Azerbaijani government told Eurasianet, speaking on condition of anonymity. Baku is unsure why Tehran is emphasizing ties with the de facto Karabakh authorities, and fears that it will serve to legitimize them in Iran and create sympathy for them, which Baku regards as a threat to its interests, the analyst said.

Zaur Shiriyev is an Academy Associate at the Royal Institute of International Affairs (Chatham House).