Turkey’s prime minister vowed Monday to punish social media users who praise the terrorism of Islamic militants; but secular critics of President Recep Tayyip Erdogan say he and his government bear some responsibility for the New Year’s Eve terror attack that left 39 people dead at an Istanbul nightclub.

Erdogan’s critics are highlighting the religious-based criticism last week of New Year festivities by pro-government media outlets and by Turkey’s leading Islamic cleric, Mehmet Gormez, head of the country’s Directorate of Religious Affairs, an official state institution.

Gormez issued a sermon that was to be preached in all of the country’s 85,000 mosques on December 30, branding New Year celebrations as “illegitimate” and arguing they belonged to “other cultures.”

The directorate, which trains and employs all of Turkey’s imams, who are technically civil servants, has become a more ideologically conservative body since Erdogan came to power. Following the nightclub attack, Gormez condemned the slaughter, saying there was no difference between targeting an entertainment venue or a temple and no terrorist attack is acceptable.

His condemnation of the massacre hasn’t mollified a group of Turkish civil society representatives, who filed a criminal complaint Monday against the cleric, saying his sermon encouraged the targeting of New Year revelers.

The dispute over the sermon and a torrent of articles from staunchly pro-government media critical of New Year festivities has reopened a heated debate over both Erdogan’s Syria policy and his government’s increasingly anti-Western tilt, and its ambivalence toward secularism.

Turkish Prime Minister Binali Yildirim pledged to punish social media sympathizers of Islamic State, which claimed responsibility for the slaughter at the Reina nightclub. “It must be known that actions praising terror are crimes and have penal sanctions,” Yildirim said via Twitter.

He added terrorism’s real aim is to “spread fear and concern among people,” and he stressed the importance of not sharing posts that could contribute to terrorist groups’ purposes.

Justice Minister Bekir Bozdag, via his official Twitter account, said people who shared messages praising terrorist organizations before and after attacks were committing a crime.

“Making the propaganda of terror and terrorist organizations and rousing people to enmity and hostility, hate and discrimination are crimes according to our law and have penal sanctions,” he said.  

Since the massacre, the first social media targets of the authorities have been members of a leftist youth organization who posted a video Sunday blaming the government for the proliferation of jihadists in Turkey.

A member of the group Halkevleri was detained Monday by police.

Opposition lawmaker Barıs Yarkadas denounced the government for targeting the leftists. “Why is the Interior Ministry bothered by youths making anti-ISIL propaganda?” he asked, using an acronym for IS.

Oya Ersoy, head of Halkevleri, pledged to continue to defend secularism in Turkey, despite government threats. “We will defend life against death and secularism against bigotry. Bigotry kills, secularism makes [people] live,” she said in a statement.

Erdogan’s domestic critics such as Ersoy contend Turkey’s president is responsible to some degree for the rise of IS, as well as other Islamic militants, maintaining the ruling Justice and Development Party has created a climate that allows radical Islamist thinking to thrive.

And they argue Erdogan’s government ignored the militants as they emerged in 2014 and 2015 in the Syrian civil war and increasingly formed the vanguard in the fight to topple Syrian President Bashar al-Assad.

Some Erdogan foes charge the country’s intelligence agencies went further in the past and actively channeled arms to jihadists and made it easy for foreign fighters to travel through Turkey to reach Syria.

In January 2014, Turkish border guards intercepted an arms shipment bound for rebels in northern Syria that they alleged had been organized by members of Turkey’s military intelligence service, MIT, on the orders of Ankara. The police involved in the shipment’s interception were subsequently dismissed from their posts.

Erdogan has long chafed at allegations his government has helped jihadists. Speaking in the country’s parliament in September 2014, he insisted he and his party had “no sympathy for the devil,” dismissing a media investigation that claimed a large number of government officials along Turkey’s southern border preferred to have jihadists in control in northern Syria than Kurds.

After the New Year’s Eve massacre, author Elif Safak said in a tweet that blame for the nightclub attack rested not only with the gunman who carried out the killing but with “fanatics who have been spreading hate speech against New Year celebrations.”