As always after a major terrorist attack on the West, the right question to ask after the slaughter in Paris is: what were the strategic aims behind the attack? This requires getting your head around the concept that terrorists have rational strategies, but once you have done that the motives behind the attacks are easy to figure out. It also becomes clear that the motives have changed.
The 9/11 attacks on the United States in 2001 followed the classical terrorist strategy of trying to trick the target government into over-reacting in ways that ultimately serve the terrorists' interests. Al-Qaeda's goal was to sucker the United States into invading Muslim countries.
Al Qaeda was a revolutionary organization whose purpose was to overthrow existing Arab governments and take power in the Arab countries, which it would then reshape in accord with its extreme Islamist ideology. The trouble was that Islamist movements were not doing very well in building mass support in the Arab world, and you need mass support if you want to make a revolution.
Osama bin Laden's innovation was to switch the terrorist attacks from Arab governments to Western ones, in the hope of luring them into invasions that would radicalize large number of Arabs and drive them into the arms of the Islamists. His hopes were fulfilled by the U.S. invasion of Iraq in 2003.
Once the Western troops went in, there was a steep decline in terrorist attacks on Western countries. Al-Qaeda wanted Western troops to stay in the Middle East and radicalize the local populations, so it made no sense to wage a terrorist campaign that might make Western countries pull their troops out again.
The resistance in Iraq grew quickly and attracted Islamist fighters from many other Arab countries. The organization originally known as "Al-Qaeda in Iraq" underwent several name changes, to "Islamic State in Iraq" in 2006; then to "Islamic State in Iraq and Syria" — ISIS for short — in 2013, and finally to simply "Islamic State" in 2014. But the key personnel and the long-term goals remained the same throughout.
The man who now calls himself the "Caliph" of Islamic State, Abu Bakr al-Bahdadi, first joined "Al-Qaeda in Iraq" and started fighting the U.S. occupation forces in Iraq in 2004. But along the way the strategy changed, for ISIS eventually grew so strong that it conquered the extensive territories in Syria and Iraq that now make up Islamic State. Popular revolutions were no longer needed. The core strategy now is simply conquest.
In that case, why are Islamic State and Al-Qaeda still attacking Western targets? One reason is because the jihadi world is now split between two rival jihadi franchises that are competing for supporters.
The split happened in 2013, when ISIS, having launched a very successful branch operation in Syria known as the Nusra Front, tried to bring it back under the control of the parent organization.
The Syrian branch resisted, and appealed to Al-Qaeda, the franchise manager of both jihadi groups, for support. Al-Qaeda backed the Syrians, whereupon ISIS broke its links with Al-Qaeda and set up as a direct competitor.
ISIS and the Nusra Front then fought a three-month war in early 2014 that killed several thousand militants and left the former in control of most of eastern Syria. Soon afterwards ISIS overran most of western Iraq and renamed itself Islamic State.
Islamic State and Al-Qaeda's local franchise, the Nusra Front, are currently observing a ceasefire in Syria, but the two brands are still in a bitter struggle for the loyalty of jihadi groups elsewhere in the Muslim world.
Spectacular terrorist operations against Western targets appeal to both franchises because they are a powerful recruiting tool in jihadi circles. But Islamic State has a further motive: it actually wants Western attacks on it to cease.
It's a real state now, with borders and an army and a more or less functional economy. It doesn't want Western forces interfering with its efforts to consolidate and expand that state, and it hopes that terrorist attacks on the West may force them to pull out.
France is a prime target because French aircraft are part of the Western-led coalition bombing Islamic State, and because it's relatively easy to recruit terrorists from France's large, impoverished and alienated Muslim minority. Russia has also become a priority target since its aircraft started bombing jihadi troops in Syria.
So the outlook is for more terrorist attacks wherever Islamic State (and, to a lesser extent, Al-Qaeda) can find willing volunteers. Western countries with smaller and better-integrated Muslim communities are less vulnerable than France, but they are targets too.
Putting foreign ground troops into Syria would only make matters worse, so the least bad option for all the countries concerned is to ride the terrorist campaign out. Horrendous though the attacks are, they pose a very small risk to the average citizen of these countries. Statistically speaking, it's still more dangerous to cross the street, let alone climb a ladder.
Gwynne Dyer is an independent journalist whose articles are published in 45 countries.