Early in June, a man walked into the Dhaka premises of the Ramakrishna Mission, a Hindu centre for spirituality and learning in the Bangladesh capital, and delivered a handwritten note warning of an attack by Islamic State.
Days later, armed policemen were sitting inside the mission's compound among orange-robed monks, the gates outside were closed and fewer people than normal showed up at a medical clinic it runs for the neighbourhood.
"We are monks, we will live and die here, but people with families are worried," Swami Shivananda, a priest managing the administration of the mission, said of the country's Hindu community, which accounts for 10 per cent of the population.
Islamic State and al Qaeda have claimed responsibility for the killings of more than 30 people since early last year, in an escalation of militant violence targeting liberals, atheists, foreigners, gays and religious minorities.
They have shocked the largely moderate Muslim country of 160 million people and heightened fears that Bangladesh, once hailed as the next Asian tiger economy with its huge garment industry, could lose out to more stable competitors in the region.
Unlike some security experts, Bangladesh authorities say the two international jihadi movements are not directly involved in the murders, many of which were carried out with machetes.
But, as the police at the Hindu mission attest, the danger is real, and counter-terrorism officials warn it could get worse with one local militant group adopting al Qaeda's methods and calling on the expertise of a former army major implicated in a failed 2011 coup.
Security officials say two local militant groups, Ansar-al-Islam and Jamaat-ul-Mujahideen, are behind the killings.
Of the two, Ansar, which pledges allegiance to al Qaeda, has emerged as the most organised and dangerous, they say, while Jamaat-ul-Mujahideen is seen as a looser organisation that claims it represents Islamic State but has no proven links to it.
"By now we have a clear idea of the organisational structure, command and control and methods of operations of Ansar-al-Islam," Monirul Islam, chief of Bangladesh's counter-terrorism police, told Reuters in a recent interview.
"They follow the ideology of al Qaeda, their operational leaders are mostly educated men, (from a) middle class background. They declare their allegiance to al Qaeda in the Indian Subcontinent (AQIS) and, through it, to Ayman al-Zawahri," he said, referring to al Qaeda's global leader.
According to Thomas Joscelyn, senior editor at The Long War Journal that tracks jihadi groups worldwide, there was evidence of more direct links between Bangladesh and al Qaeda, and he warned the Islamist militant threat had been underestimated.
"We now have competition between al Qaeda and the Islamic State in Bangladesh, which means that the jihadist pool is deep enough for both organizations to operate in the country."
In May, 2015, AQIS leader Asim Umar claimed responsibility for the murder of Avijit Roy, a US citizen and blogger hacked to death in Bangladesh that February. US officials said at the time they were unable to confirm the claim.
Initially, Ansar struck bloggers and publishers critical of radical Islam, then university teachers, including one who asked a woman student to remove her veil in class.
In April, it said it murdered two gay rights activists, saying they were promoting anti-Islamic activities, police said.
Also worrying for authorities is the apparent rise within Ansar's ranks of former army Major Syed Mohammad Ziaul Haque, who went into hiding after the military accused him of involvement in a plot to overthrow the government in 2011.
"We have a suspicion that the ex-major is one of their leaders," said counter-terrorism chief Islam. "He is in hiding. We know his capability. If he is involved, it is a strength for Ansar-al-Islam."
Zia, as intelligence agencies call him, was from the engineer corps and trained in special operations.
His would be the first known case of a Bangladesh military officer switching sides to join a militant group, although it has happened elsewhere.
A military spokesman said Zia had been dismissed from service five years ago, but added that he was not in a position to speak about Zia's activities since then.
Zia's involvement with Ansar was first mentioned by the head of its predecessor group following his capture in 2013, two police officials said.
Zia was helping in the training of the fighters, motivating them to carry out jihad against "anti-Islam" forces and also taught bomb-making skills, one official briefed on the interrogation report said.
Reuters could not independently verify the police claims.
At the same time, Islamic State has said it was behind the killings of Hindus, Buddhists and members of minority Muslim sects, which have accelerated in recent weeks.
Security officials tie those deaths to Jamaat-ul-Mujahideen, a home grown group inspired by Islamic State's vision of a caliphate.
Police official Islam said authorities had found computer evidence that Bangladesh-origin foreign fighters, some in Syria, were claiming attacks on behalf of Islamic State as soon as they occurred.
But he said there was no evidence of operational ties with the Middle East-based movement.