DHAKA - Bangladesh said Sunday the attackers who slaughtered 20 hostages at a restaurant in Dhaka were well-educated followers of a homegrown militant outfit who found extremism "fashionable", denying links to the Islamic State group.
As the country began two days of mourning for victims, details have emerged of how the assailants spared the lives of Muslims while herding foreigners to their deaths.
Prime Minister Sheikh Hasina vowed to drag Bangladesh back from the brink, warning of a concerted bid to turn one of the world's most populous nations into a failed state, while her government has continued to deny links between the assault and international jihadist networks.
The Islamic State group claimed responsibility for the attack, saying it had targeted a gathering of "citizens of crusader states" at the Western-style cafe on Friday night.
But Home Minister Asaduzzaman Khan told AFP the killers - six of whom were shot dead in the siege - were members of the homegrown militant outfit Jamaeytul Mujahdeen Bangladesh (JMB), a group banned over a decade ago.
"They have no connections with the Islamic State," Khan said.
National police chief Shahidul Hoque told reporters that investigators would explore the possibility of "an international link" but added that "primarily, we suspect they are JMB members".
The bodies of twenty hostages were found in pools of blood after commandos stormed the Holey Artisan Bakery cafe to end the standoff, in which two policemen were also shot dead in a fierce gunbattle at its outset.
Six of the gunmen were killed by the commandos in the final stages of the siege, but one was taken alive and was being interrogated by Bangladeshi intelligence.
Security officials said most of the victims - 18 of whom were foreigners - were slaughtered with sharpened machete-style weapons.
Hasina's government has previously blamed a string of deadly attacks against religious minorities and foreigners on domestic opponents but the latest will heighten fears that IS's reach is spreading.
Analysts say that the government is wary of acknowledging that groups such as IS or Al-Qaeda have gained a foothold over fears that it will frighten off foreign investors.
But Shahedul Anam Khan, an analyst for the Dhaka-based Daily Star newspaper, said the attack meant the government could no longer plausibly deny their presence.
"While one is not sure that these people are organically linked to the international extremist groups, the government must own up to the reality that the footprints of the IS in this country is very real and no amount of denying can alter the fact," he wrote.
There was mass condemnation of the killing in Dhaka, where flags were being flown at half-mast at government offices, while prayer services were being held across the country.
Italy was mourning the death of nine citizens in the attack while seven Japanese were also killed.
Japan's Prime Minister Shinzo Abe spoke of his "profound anger that so many innocent people have lost their lives in the cruel and nefarious terrorism". Pope Francis also joining the welter of condemnation.
The other victims were an American citizen and a 19-year-old Indian who was studying in California.
A Bangladeshi worker at the cafe who survived the massacre told how the attackers split the diners into groups of foreigners and locals, making clear that their targets were non-Muslims.
"They took me and two of my colleagues and forced us to sit on chairs, with our heads down on the table," the survivor told AFP on condition of anonymity.
"They asked me whether I was a Muslim. As I said yes, they said they won't harm or kill any Muslims. They will only kill the non-Muslims.
"All the time I prayed to Allah, keeping my head down. Several times I vomited.
"They warned us not to raise our heads but at one point I raised my head slightly and saw a bloodied body on the floor." The worker described the killers as appearing to be university-educated, a point echoed by Khan.
"They are all highly educated young men and went to university. No one is from a madrassa," the minister said.
Asked why they would have become Islamist militants, Khan said: "It has become a fashion."
The attack, by far the deadliest of a recent wave of killings claimed by IS or a local Al-Qaeda offshoot, was carried out in the upmarket Gulshan neighbourhood which is home to the country's elite and many embassies.
Last month authorities launched a crackdown on local jihadists, arresting more than 11,000 people but critics allege the arrests were arbitrary or designed to silence political opponents.
Bangladesh's main Islamist party has been banned from contesting polls and most of its leaders have been arrested or else executed after recent trials over their role in the 1971 war of independence from Pakistan.