On the evening of July 1, five militants pledging allegiance to the Islamic State attacked Holey Artisan Bakery, a Spanish-styled restaurant situated in the diplomatic area of Bangladesh’s capital city, killing 20 guests, most of them foreigners.

The attack did not come totally out of the blue.

Since February 2015, groups affiliated to the Al Qaeda had carried out a series of targeted killings of so-called "atheists bloggers", their publishers and LBGT activists. In addition, from September 2015, the Islamic State had claimed responsibility for a string of murders of foreigners and religious minorities. Indeed, in the 16 months before the Holey attack, there had been over 25 killings claimed by groups or individuals linked to one or the other of these jihadi organisations.

However, the scale of the Holey attack – involving a hostage situation and a mass killing of foreigners – triggered a new seriousness in state authorities on seeking to deal with the terrorist threat.

It also resulted in Bangladeshis thinking about the nature of the militant threat and the extent of its support.

People were surprised to discover that only one of the five militants involved in the Holey restaurant attack was educated in a religious madrassa and that three of the militants had gone to well-known private schools in Dhaka and belonged to middle-class homes.

It also became clear that these five men were just the tip of a large iceberg of men – many from educated households – who had gone "missing" in circumstances that suggested they may have joined the militant cause.

While it is unwise to rely on the actions or announcements of Bangladeshi law enforcement authorities as an accurate guide to the reality of the militant threat, the arrest of over a hundred suspected militants in recent months – along with the killing of dozens more – suggests, at the very least, that the network of active members, accomplices and sympathisers may well be large.

However, should we be surprised to learn that these networks are quite so large?

Perhaps not - had we been paying attention to a 2014 Pew Research Centre poll on the attitudes towards extremism of people living in 14 countries with significant Muslim populations.

The results of this poll suggest that high proportions of people in Bangladesh hold extremist views justifying suicide bombers and attacks on civilians as a way of "defending Islam" – a much higher percentage than almost all the other 13 countries surveyed.

One of the questions asked by Pew was this: “Some people think that suicide bombing and other forms of violence against civilian targets are justified in order to defend Islam from its enemies. Other people believe that, no matter what the reason, this kind of violence is never justified. Do you personally feel that this kind of violence is often justified to defend Islam, sometimes justified, rarely justified, or never justified?”

The results for Bangladesh were breathtaking – 47% of the 1,000 randomly selected people questioned in the country thought suicide bombings or other forms of violence against civilian targets can "often" or "sometimes" be justified.

As the table below (using data extracted from the report) shows, none of the other 13 countries had a higher percentage of people with similar views.

Indeed, Bangladesh had double the proportion of people justifying suicide bombings and violence against civilian targets than nine of the other countries surveyed. Particularly eye-catching was the percentage of people in Pakistan who justified suicide bombings "often" or "sometimes", which stood at only 3%.

Bangladesh's 47% figure was divided into 14% who thought it could "often" be justified and 33% who thought it could "sometimes" be justified. Only 33% said it could "never be justified".

Only one country, the Palestinian territories, had a higher proportion of people than Bangladesh who thought this kind of violence was "often" justified (see table below).

Such views were reflected in the results of a couple of other questions in the same poll.

Twenty-eight percent of people in Bangladesh had a "favorable" view of both Hamas and Hezbollah – with only the Palestinian territories and Lebanon having a higher percentage of people holding similar views. In Pakistan, only 8% had a "favorable" view. However, the poll in Bangladesh did find that 56% – a much higher percentage of people than from many other countries – also had an "unfavorable" view of both organisations.

This, of course, is only one poll.

A survey done two years earlier, also by Pew, (which asked a similar but slightly different question and, therefore, not directly comparable), found that a smaller proportion of people from Bangladesh – 26% – thought that suicide bombings/civilian attacks were "often" or "sometimes" justified. But even this figure, as the table below shows (see Q89, p216 of the report) represented over a quarter of the Bangladesh respondents, and was much higher than 16 of the 20 countries surveyed.

What does this mean?

A common meme used to describe Bangladesh is to say that it is a "moderate Muslim" country. In 2014, for example, Dan Mozena, who was then the United States ambassador to Bangladesh, was quoted as stating that the country was "a moderate and generally secular and tolerant – though sometimes this is getting stretched at the moment – alternative to violent extremism in a very troubled part of the world".

There is much that supports such a description. Bangladesh won independence from Pakistan, resulting in the defeat of the Islamic fundamentalist parties that supported the Pakistan military. Neither of the country’s top three political parties are explicitly religious, and the party now in power is secular. And while there has been significant political violence in Bangladesh since the return of democracy in 1990, this is mostly inter-party, and not of a religious nature. In addition, women’s rights have demonstrably improved over the years.

Moreover, the high figure could represent the fact that at the time the polls were taken, the country had not suffered from any significant militancy – and that following the string of targeted killings from 2015 and the Holey restaurant attack in July 2016, people’s view will have changed.

Nonetheless, the polls do suggest that behind the impression of a "moderate" Bangladesh, there are high proportions of people in the country who hold views that support Islamic militant violence.

And this could well help explain the new growth of militancy in Bangladesh, and suggest that the network of militant sympathisers – and the pool of people from which they can be recruited and who will support them – may well be much higher than most people imagine.