IT WAS prayer time at the Northern Mosque in Khasavyurt, a town in western Dagestan, when troops in black balaclavas arrived one day in February. “They said: ‘This mosque is closing—turn off the lights and hand over the keys’,” recalls one of the congregants. The next day Muhammad Nabi Magomedov, a local imam, led some 5,000 Salafi believers in a march on city hall, chanting “Allahu akbar!” and “Return our mosque!” In early April the security services came for Mr Magomedov, arresting him on terrorism charges.

Once in custody, the imam was told to shave off his beard. Then six men took him into a room. “One said: ‘Get on your knees’,” Mr Magomedov later told a member of Russia’s prison oversight committee, who shared details of their conversation with The Economist. “I said, ‘I won’t get on my knees’.” The men beat up Mr Magomedov, sending a clear signal to the ultra-conservative Salafi community: there will be no dialogue. “It’s a shame,” says Rasul, one of Mr Magomedov’s young followers. “He was one of the peaceful ones.”

Since last autumn, the authorities in Dagestan have ramped up pressure against Salafis. They have reason to worry: as Moscow launched air strikes in support of Syria’s government, the Islamic State (IS) declared a holy war on Russia, took credit for downing a Russian passenger jet over Egypt and released a video threatening “a sea of blood” in Russia itself. Officially, some 900 Dagestanis have left for Syria. Independent experts say the true figure may be as high as 4,000. Even the conservative estimate means that relative to its population, Dagestan has supplied nearly eight times more jihadists than Belgium, the leading source of European foreign fighters. Most fighters who stayed in Dagestan have switched their allegiance from the Caucasus Emirate, a regional insurgent group linked with al-Qaeda, to IS, which last year claimed the Russian North Caucasus as one of its provinces.

So far, IS has failed to launch a big attack on Russian soil. In fact, the exodus of radicals to Syria led to a drop-off in the ongoing low-level insurgency in Dagestan: casualties fell 46% in 2014 and a further 51% in 2015. Yet the past six months have seen a series of smaller attacks, including car bombings, suicide-attacks on police and a deadly shooting at an ancient citadel in Derbent. Violence and flows of money are picking up, says Akhmet Yarlykapov of the Moscow State Institute of International Relations. IS runs several Russian-language media outlets, and Russian officials fret about recruitment. While Mr Magomedov was leading his protest, IS released a video calling on Dagestanis to resist the mosque closures by force.