A magnet for foreign jihadists during its 1990s war, Bosnia is now grappling with the threat from home-grown extremists wooed by the conflicts in Iraq and Syria.
While most Bosnian Muslims are moderates, a few thousand have adopted the ultraconservative Salafist brand of Sunni Islam introduced by the fighters who flocked to Bosnia from North Africa, the Middle East and Asia during the 1992-1995 conflict between Serbs, Muslims and Croats.
Most of those foreign fighters, or "mujahedeen", left Bosnia when the war ended.
But the seed had already been sown. Twenty years on, the radical preachers giving fiery sermons in "mesdzids", or improvised prayer halls, are no longer foreigners.
Those taking up arms are also local men.
On Monday, a gunman shouting "Allahu Akbar" ("God is greatest" in Arabic) opened fire on a police station in the eastern town of Zvornik, killing one officer and wounding two others before being killed in a shootout.
The assailant, identified as 24-year-old Nerdin Ibric from a village near the northeastern town of Zvornik, was suspected of links to radical Islamist groups. Another man, said to have travelled to Syria, was arrested Tuesday over the attack.
Suspected Islamist extremists had made their presence felt before in the Balkan country.
In October 2011, a gunman opened fire on the US embassy in Sarajevo, wounding a policeman before being injured himself and arrested.
In June of the previous year, a man set off an explosive device at a police station in the central town of Bugojno, killing one officer and wounding six others in what the government called a "terrorist act".
- Prayer room recruitment -
Would-be jihadists are suspected of being recruited by radical preachers, operating through a network of informal prayer rooms.
"There is no doubt that the recruitment process is possible due to the existence of a network of such places of worship," Esad Hecimovic, a local journalist who has reported extensively on the subject told AFP.
Hardliners, whose numbers are estimated by the authorities at around 3,000 followers, represent just a fraction of Bosnian Muslims, who make up around 40 per cent of the population of 3.8 million.
But their ranks are suspecting of supplying scores of fighters to the wars in the Middle East.
- 'Terrorism spreading' -
Reacting to the attack on the police station in Zvornik Security Minister Dragan Mektic warned terrorism had become "a serious problem".
"We need to use all our capacity to stop this terrorism that has been spreading in Bosnia," he said.
"Either we defeat terrorism or it will defeat us."
Some 150 Bosnians are believed to have joined jihadists groups in Iraq and Syria, while some 50 others have already been and returned from the battlefield, according to the intelligence services.
Two men arrested at Sarajevo airport in February were charged with attempting to join the Islamic State group, which has sown terror throughout the Middle East and North Africa and executed several Western hostages.
"Those who return to the country are very dangerous. They are of course under surveillance but the danger is that they start to recruit others," said Jasmin Ahic, a professor at the Sarajevo University Faculty of Criminology.
- Stiff sentences -
To prevent their departure, parliament last year introduced sentences of up to 20 years in prison for jihadists and their recruiters.
In January, a radical imam in the northwestern town of Buzim was the first person to go on trial accused of recruiting people for jihad.
Husein Bosnic, a former member of a mujahedeen unit in Bosnia's war, replaced Nusret Imamovic as leader of the country's Salafists after Imamovic left for Syria in late 2013, according to intelligence sources and the US State Department.
Imamovic, who is named on a US State Department terrorist list, is believed to be the third-in-command of Al-Qaeda's Syria affiliate Al-Nusra Front.
Testifying at Bosnic's trial in Sarajevo, the relatives of several youths who travelled to Syria or Iraq, some of whom have died in fighting, said their kin attended his sermons.
The prosecution accused the cleric of receiving "significant" funding from unnamed backers in Arab states.
Bosnia's Balkans neighbours Albania, Serbia and Kosovo have also swooped on jihadist networks in recent weeks.
Fifteen men went on trial in Serbia and Albania in March accused of recruiting and financing volunteers for the war in Syria.
"For the first time in the region, people who call on others, in a very sophisticated way, to go to foreign battlefields and commit crimes, are being tried," Ahic said.
"What will come out of these trials has yet to be seen."