NEW DELHI - Bangladesh has been hit by a surge in Islamist attacks in the past three years that reached new heights last weekend when 20 hostages were murdered in Dhaka.
The wave of attacks has been notably brutal with many of the victims, including the hostages, hacked to death with machetes.
One week on from the end of the siege at an upmarket cafe in the capital, AFP looks at some of the factors fuelling the attacks, who might be responsible and how the government is reacting: Bangladesh has been blighted by unrest since it broke from Pakistan in a war of independence in 1971 and has witnessed more than a dozen coups.
Islamist groups such as Jamayetul Mujahideen Bangladesh (JMB) and the newer Ansarullah Bangla Team have long posed a challenge to authorities, with the JMB killing at least 28 people in a bombing campaign in 2005.
The group, blamed by the government for the Dhaka siege, was banned after the 2005 attacks and is seen as a largely spent force following the subsequent arrest and execution of its leaders.
While the 2005 attacks were largely indiscriminate, the recent killings have had specific targets, including secular bloggers and gay activists.
Members of minority groups such as Hindus, Christians and Sufi Muslims have also been victims, with many of them hacked to death.
Although a handful of foreigners had previously been killed, last weekend's siege was by far the deadliest attack. The victims included nine Italians and seven Japanese.
Experts point to several factors behind the recent violence, including the execution of top Islamists over their role in the independence war.
Hundreds of thousands of people took to the streets in 2013 to protest at the guilty verdicts handed down by a domestic tribunal that critics say was intent on neutering opposition to Prime Minister Sheikh Hasina.
The Supreme Court then barred the biggest Islamist political party Jamaat-e-Islami from contesting the 2014 general election, disenfranchising millions of supporters.
The main opposition Bangladesh Nationalist Party - allied to Jamaat - subsequently boycotted the polls. What was then effectively a one-horse race was held against the backdrop of firebombings across the country.
Many observers say the lack of genuine democracy has made Bangladesh a fertile ground for extremists.
"There is a lot of support for the organisations (Hasina) is trying to quash," said C. Christine Fair, associate professor at Georgetown University in Washington and South Asia expert.
"The country is torn. She is essentially silencing, politically, half the country." Both the Islamic State (IS) organisation and the competing Al-Qaeda in the Indian Subcontinent (AQIS) have claimed many of the attacks.
However, the government insists international jihadist networks have not got a foothold in Bangladesh and that local extremists are culpable.
There is little evidence that IS trains and funds attackers in the country, although it has recruited Bangladeshis to fight in Syria.
More likely, analysts say, is that radicalised youths are being inspired by the group and pledge allegiance - a murky line in the age of social media.
During the cafe siege, IS was sent gruesome pictures of the carnage by the attackers, which it immediately distributed via its affiliate news agency Amaq.
Al-Qaeda may have more of a claim of presence in Bangladesh, with Bangladeshi fighters aiding the anti-Soviet mujahedeen in Afghanistan as far back as the 1980s.
"The ties to AQIS are much more credible. South Asia is Al-Qaeda territory," said Fair.
The use of machetes has become a chilling hallmark of the murders and nearly all the slain hostages were attacked with sharp blades, even though their killers had automatic weapons.
Some experts say a lack of access to suicide vests or car bombs explains the prevalence of machete attacks but others see a more deliberate reason behind the brutal killing style.
"They wanted to show the world that they can go to any extent for jihad," said K. G. Suresh of New Delhi's Vivekananda International Foundation think-tank.
Bangladesh is intensely politically polarised, characterised by a poisonous rivalry between Hasina and the main opposition leader Khaleda Zia that stretches back decades.
Although around 90 percent of Bangladesh's 160 million-strong population is Muslim, mostly Sunni, the nation is officially secular.
Creeping popular support for fundamentalism has led to mounting calls for Islamist representation in government and public life.
One recent study found around 47 percent of Bangladeshis say suicide bombing is justifiable to defend Islam, higher than other Muslim-majority nation in South and Southeast Asia.