Faced with the loss of territory and influence in the Middle East, ISIS is determined to show the world that it is still capable of carrying out terrorist attacks despite global efforts to defeat the terrorist group.

The more ISIS is weakened, the harder it will strive to prove its might, even enlisting foreign fighters and sleeper cells in the West to inflict the carnage. Most Muslim groups and countries are not exempt from being a target of ISIS, either. The latest terror attack in the Rawdah mosque in Egypt, which left 305 casualties — including 27 children — and more than a hundred people injured, is just another example.

If this attack was carried out by ISIS or any of its affiliates, which is a strong possibility, a parallel goal of such terrorist attacks is sending a clear message to civilians, sympathizers and its own militants and fighters. To civilians, the Sufis in this case, whom they do not see as Muslims but grave worshippers, the message is one of intense fear, anxiety and distress. To sympathizers, particularly those whose confidence in the terrorist group may be wavering in light of recent setbacks, the message is to never give up or abandon the cause. It is like saying: “See, we are still who we are. Do not believe what they say.”

To its own members — many of whom may be filled with desperation and disappointment that so many of the group’s militants have been killed by allied forces — the message is one of encouragement to not lose heart.

That may indeed be the case, if the response to terrorism does not go beyond talking about such attacks and their consequences. Terror attacks by ISIS and similarly aligned groups will never end as long as the jihadi Salafism ideology has a source on which to feed and therefore survive.

The war on terrorism includes tactical elements, of course, but tactics represent a mere 5 percent to 10 percent of an effective solution. Tactical interventions are quite limited in their ability to vanquish terrorism and are at best only a bandage solution. A holistic approach is required. Simply removing ISIS from the region, as some might advocate, is woefully inadequate because heavy tools such as weapons are no match against abstract targets such as ideologies. A weapons-based approach sometimes serves only to strengthen a fiercely held ideology. A part of the solution to jihadist terrorism must come from Muslims willing to shoulder the problem rather than ignore it. A moderate, modern and mainstream Muslim mindset and structure should be offered as an alternative.

On the other side, the Western as well as Muslim states that are home for some ISIS foreign fighters should apply counterterrorism policies much more responsibly than before. Rather than discriminating, distancing and alienating, they should stay close, connected and involved with the Muslim communities and sects.

Democratic values shall never be omitted in the name of fighting terrorism as the democracy and terrorism is mutually exclusive. One critical rule here is terrorist organizations always benefit from the violation of democracy and human rights, and recruit more. Stricter policies and applications may backfire and only worsen the case. Instead, “winning hearts and minds” should one of the policies.

When I was running a police department in a region where terrorism was an issue in Turkey, I had a policy of close connections with the diverse community to understand them, get their pulse and serve them better. In addition to our security services, we were trying to gain their hearts and minds. For instance, two of my officers were doing activities with students, such as playing soccer, organizing and providing police uniforms for children. Soon after, the students were so affected and changed that plenty of them wanted to become police officers.

One of the students who applied to take the police high school entrance exam was special. We had intelligence that one of his uncles was killed as a guerrilla fighter by the security forces, and another one was still active in terrorist activities. Further, his village was a supporter of the terrorist organization. However, in spite of such conditions, he selected to be on our side. It was not an easy job for us, but it was not impossible, either. One shall never forget: the line to gain or lose is so thin and sensitive.

Military or law enforcement intervention can only skim the surface of the problem. The quagmire deep below the surface — Salafi Jihadism in the case of ISIS — will remain no matter how many terrorists military operatives kill. Muslims should offer and promote an alternative: mainstream and moderate Islam that has the principles of peace, compromise and the inherent value of all people regardless of religion, ethnicity, race or any other factor at its core rather than fighting, violence and killing any human being who does not share a more radical view of Islam.

In addition, the Western democracies shall apply smart policies to gain the hearts and minds of the communities and groups that are on the target of terrorist recruiters, especially when alienated and discriminated.

Finally, school curricula should be designed in countering violent ideologies and extremism in both Western and Muslim countries. They should cover issues on terrorism that could enlighten young generations and prevent them being recruited or radicalized.