A slaughter of foreign hostages has put Bangladesh firmly on the frontline of the global war on terror despite government efforts to portray a campaign of attacks as the work of domestic opponents, according to analysts.

Several dozen people have been killed by jihadists in Bangladesh in the last two years, the victims including mainly local atheist bloggers, Hindus, gay activists and liberal academics.

But while those attacks generated few column inches beyond Bangladesh, this weekend's hostage siege in a Dhaka cafe led news bulletins around the world, attracting the kind of attention its perpetrators had long been craving.

Analysts said the choice of venue, target, timing and method of killing were all designed to maximise publicity for jihadists who were well aware of the outrage that greeted recent massacres in Orlando and Paris.

Source: b'Police officials at the site of the attack | Source: Reuters'

Eighteen of the 20 civilians who were killed in the Holey Artisan Bakery were foreigners. Nearly all were hacked to death with machetes, even though the hostage-takers had plenty of firearms.

The attack was even more shocking as it came on the final weekend of Ramadan, with survivors describing how the hostage-takers made clear their targets were non-Muslims, separating locals from the foreigners.

Around 90 percent of Bangladesh's 160 million people are Muslims but the state is officially secular.

"By hacking people to death... they wanted to show the world that they can go to any extent for jihad," said K G Suresh, a senior fellow at New Delhi's Vivekananda International Foundation think-tank.

"Once they attack a restaurant popular with foreigners on a Friday night their message is clear who they want to go after. By sparing Muslims, they wanted to send out the message that they are only against Westerners."

Source: b'Police officials at the site of the attack in Dhaka | Source: \xc2\xa0Reuters'

According to the monitoring group SITE, the Islamic State organisation claimed responsibility for the attack which it said had targeted "citizens of crusader states".

But Prime Minister Sheikh Hasina's secular government has long insisted neither IS nor Al-Qaeda have gained a foothold in Bangladesh despite both groups claiming many previous attacks.

That line was reiterated by Home Minister Asaduzzaman Khan who told AFP that six gunmen killed at the end of the siege were members of Jamaeytul Mujahdeen Bangladesh, a domestic group which has been banned for a decade.

He denied any link with IS but analysts said that stretched credibility.

Source: b'Is Bangladesh ready to handle terrorism | Source: Reuters'

Taj Hashmi, a Bangladeshi who teaches security studies at the Austin Peay State University in the US, said there could be "no ambiguity" that the attack was the work of IS.

"Bangladesh must admit that international Islamist networks are actively engaged in killing people in the country and they are not through yet," said Hashmi.

Mubashar Hasan, an expert on political Islam at Dhaka's Liberal Arts University, said it was not merely a local difficulty but was the latest in a line that stretched back to the attacks in New York and Washington on September 11, 2001.

"This is Bangladesh's 9/11. Bangladesh has now entered into the global war on terror," Hasan told AFP.

Critics have said the violence stems from the government's refusal to allow its opponents to operate freely in the political mainstream.

Source: b'Analysts say the government is in denial | Source: Reuters'

The columnist Zafar Sohban urged the government to end "its state of denial".

"It cannot continue to bury its head in the sand about the clear and convincing evidence of transnational links to domestic terror groups and operations," he wrote in the Dhaka Tribune.

Subhash Agrawal of the Delhi-based India Focus political risk consultancy, said the recent arrests of thousands of Bangladeshis that the government says was organised to eradicate extremism had been counter-productive.

"She has been focusing on her political opponents and going after Begum Khaleda Zia's people while turning a blind eye to the alarming political and social polarisation in her country," Agrawal told AFP.

"Arresting so many people is simply stupid."