Imagine a scenario. A month from now, American A10 warthogs fly in the skies as moderate Syrian rebels attack Raqqa in Syria from the west.

In Mosul, Iraqi and Kurdish forces take the city from the east. The borders of the Islamic Caliphate are destroyed. ‎The self-styled Caliph Ibrahim and his Shura Council are dead.

Coalition airstrikes deliver a decisive blow to the retreating ISIL fighters.

Is that victory? On many counts it is the best case scenario but, best scenarios are seldom realised. Any victory against ISIL will be messy and will take a long time. A lot of people will die, many of whom will not deserve that death.

But will ISIL the idea ever die? You can stop tanks and Humvees from crossing borders and killing people. You can kill as many people as you want with guns. But ideas are problematic.

Within diplomatic circles here in Iraq some are beginning to wonder what comes after, and no one seems to have an idea what the answer might be.

One western diplomatic source told me: "The idea of ISIL will simply go underground once the group is defeated. There it will wait, wait for another opportunity to emerge."

With such chaos in the region, another opportunity is never far away.

What al-Qaeda, ISIL and other extremist groups need in order to thrive are situations they can exploit.

In 2008, I travelled with Pakistan's Army to the Bajaur region, deep in the tribal heartlands of the northwest where it was in the process of pushing back the Pakistani Taliban. There I met with tribal elders and we spoke about why the Taliban had been able to recruit locals.

I remember him saying something along the lines of this: "Look around you. For decades we've had no electricity. No phone lines. There are no schools, roads. We've been living the same way, the world has moved on and we haven't. This is the land the government forgot, but not the Taliban. They exploited that."

That idea of being able to exploit situations is one I've heard across the region. In urban areas with no electricity, in cities like Karachi and Lahore, in supposedly developed places like Baghdad that have no running water. From people in Anbar Province, Iraq, who complain they've been left behind.

In all of these places I've seen a familiar pattern develop. Young men go to the mosque, simply for something to do. The clerics there encourage them to live a peaceful, simple life. Then politics gets involved. Then arrives a man with a gun and says fight and, for some, the temptation to fight becomes too much.

For others, who live in Western society, the appeal of a group like ISIL is much more nuanced, but the desire to fight injustice is still prevalent. The ideas of ISIL, of al-Qaeda, are born and spread this way.

Dr Wathaq Al Hashemi, director of the Iraqi Group for Strategic Studies, has spent a lot of time thinking about what happens after the group is defeated, but the idea remains.

"How to fight an idea that cannot be vanquished by any military weapon or physical interface? It is a spiritual and psychological idea that spreads like a virus through the brainwashing the young and the naïve by ISIL leaders in the name of Islam.‎ In order to fight it, you use the tools they use, but you also have to stop the conditions that lead them to listening to extremist views."

After the bombs

That is perhaps the biggest challenge the world faces, and not just in dealing with extremist groups of all religious and political hues, even in places like Hong Kong and the Ukraine it is worth thinking about.

The conditions that allow men to urge others to fight need to be looked at, otherwise you'll spend billions of dollars going to war only to have to go to war once more because the idea was never countered.

In one of those moments of "What If?" that I seem to play with people in my spare time I speculated out loud what might have happened if Osama Bin Laden, instead of being killed by American special forces, was captured and put on trial.

If his writings and public statements are anything to go by, the trial would have been less about his role in any criminal activity and more about his philosophy.

Given the global media exposure such a trail would have received, perhaps that might have been the trigger needed to debate what al-Qaeda's ideology really means.

This is not an idea that will ever be taken seriously by anyone, after all a Western court room is hardly the place to debate one man's interpretation of an Eastern religion.

Exposure and debate, however, would seem to be key. In short, we need clearer dialogue and understanding about what it means to be a believer in ISIL.

Without these moves the idea of ISIL will never be understood. That is what men like Dr Al Hashemi are trying to push for: A forum to take on the ideas of ISIL while taking away the group’s ability to exploit situations.

Fighting ideas with ideas seems the only way they can be countered. I'm not suggesting the world open up diplomatic channels with ‎the Islamic State or invite them to the next United Nations General Assembly, but one thing is absolutely clear. Bombs may defeat the group, but what happens when they finish dropping is equally important.

Follow Imran Khan on Twitter @ajimran