The announcement by Spain's new prime minister, Jose Luis RodrIguez Zapatero, that Spanish troops will be withdrawn from Iraq by 30 June should be welcomed by anyone who is really interested in controlling terrorism. Using the tactic of inflicting maximum damage on civilian populations which is al-Qaeda's trademark, the Madrid bombers aimed to destabilise Spanish democracy and provoke repressive measures against Spain's Islamic minority. Nothing would suit the terrorists better than to foment conflict between Muslims and the secular majority in Europe, but in this case they have been thwarted. By pulling out of the catastrophe that is unfolding in Iraq, Spain can concentrate its resources on the rigorous security measures and continuing political initiatives that together form the only known remedy for terrorist violence.
Spain's decision ought to be greeted as a sign of political maturity, but it is sure to be attacked as a policy that rewards the terrorists. Not only in the United States but also in Britain, neoconservatives of all parties will condemn the Spanish government for appeasement - accusing it, in effect, of the cowardice in the face of evil displayed by Neville Chamberlain in the 1930s. Zapatero's stance will be contrasted with the supposed moral virility of George Bush, and there will be more than a hint of admiration among neo-cons at the way in which, as they believe, al-Qaeda is playing so successfully on the frailties of decadent Europe.
In this neoconservative fantasy world, only an uncompromising refusal to have any truck with terrorism stands any chance of defeating it, but in the real world things are done rather differently. Appeasement has been present wherever terrorist violence has been controlled successfully. It was an essential ingredient in the mix of policies implemented by successive British governments in Northern Ireland - one of the few genuine success stories in the history of counter-terrorism - and it is a major element of the progress that has been made in ending decades of terrorist murder and suicide bombing in Sri Lanka.
Appeasement is only another name for the willingness to negotiate. Where this is lacking, as it is at present in the conflict between Israel and the Palestinians, and has been until recently in Kashmir, terrorism is uncontrollable.
The truth is that force alone cannot end terrorist violence. Conventional military operations are useless, as the chief problem in counter-terrorism is identifying and apprehending the terrorist: essentially a type of police work that depends heavily on information gathered from the broader community. Conventional military operations of the kind currently being undertaken by the Americans in Iraq make this difficult or impossible. They can hardly avoid alienating the population and increasing terrorist support. This is particularly true when - as in Fallujah over the past weeks - the Americans have been responding to attacks on their forces with hugely disproportionate firepower.
These tactics are all too familiar. They are part of a pattern of escalating violence that has invariably ended in humiliating defeat for the occupying power - not only in Vietnam, but also in Algeria, where the French forces conducted their "war on terror" with extreme ruthlessness, but were compelled to withdraw in the end anyway. The Russian experience in Chechnya provides an even more ominous parallel. There the use of savage and overwhelming force has produced only anarchy and endemic kidnapping, and failed to prevent atrocities such as those committed in Moscow in October 2002, when hostages taken at a Moscow theatre by Chechen-related suicide bombers were rescued only after the use of toxic gas, from which many have subsequently died.
Incapable of learning from history, the Americans are poised to repeat it. They are determined to take the radical Shia cleric Moqtada al-Sadr "dead or alive", supposedly in order to execute a warrant for his arrest issued some months ago after the murder of a rival cleric, but, in the perception of many Iraqis, to take reprisal for the massacre of four US contractors on 31 March. This can only unify the resistance against them. In toppling Saddam Hussein the Americans destroyed the state in Iraq, producing the anarchy which has plagued that country ever since. At the same time, by dismantling Saddam's secular regime, they empowered radical Islam, in effect, and ensured that it would emerge as the most powerful political force in Iraq.
Now, with their barbaric assaults on densely populated parts of Fallujah this month, the Americans have brought together Shias and Sunnis into an insurgency that looks increasingly like the wars of national liberation of the late 20th century. The alliance between rival Islamist forces may not endure, but for the time being it looks real enough to make the position of the Americans untenable. When - not if - US forces are driven out, in the bloody aftermath of the collapse of the planned transition to Iraqi sovereignty, Iraqis will face a protracted civil war and the likely break-up of the state constructed by the British more than 80 years ago.
The notion that anything resembling western-style democracy can be installed in such circumstances betrays a lack of realism bordering on the deranged, but it is of a piece with the delusional thinking that launched the war in the first place. There was never the remotest prospect of peace in occupied Iraq. Equally, creating a functioning modern state from a country in Iraq's position takes decades not months, and requires skills that the Americans simply do not possess. The prospect must now be that after a further escalation of violence in the run-up to the US presidential election, the Americans will accept defeat and call it victory. The policing of Iraq will be handed over to the UN. Whether the new president turns out to be George W Bush or John Kerry, he will then be able to tell his fellow Americans that they have discharged their obligation to freedom and humanity.
The end of America's ill-fated intervention in Iraq is looming into view, and it is foolish to try to forestall it. It is often said that Britain should use its influence to ensure that the US does not turn its back on the hideous mess it has made, but this is mere self-delusion. At present, no one - least of all Britain's abject and ineffectual Prime Minister - has any significant influence over US policy, which is shaped almost entirely by US domestic political imperatives. The most sensible course is to recognise this fact and act on it - which is precisely what the Spanish government is doing by withdrawing its forces from Iraq.
Those who attack Spain's decision must presumably believe that it would do some good if it maintained its presence. Yet any forces that remain in Iraq will be perceived as continuing an illegitimate American war. Even troops explicitly mandated as peacemakers by the UN may find their legitimacy tainted in this way. It is entirely possible that there is no way of preventing a further slide into anarchy in Iraq. It may be this that has made President Vladimir Putin - who refused to commit troops to Iraq - decide to withdraw Russian civilian workers from that country as well.
If other countries with troops in Iraq follow Spain's example they, too, will undoubtedly be accused of appeasement. They should not be terribly concerned to refute the charge. In the context of an unjust, unnecessary and unwinnable war there is no virtue in stoical resolution. Greater courage is shown in making an end of a bad job. Pulling troops out of Iraq will not eliminate the threat of terrorism. Al-Qaeda seems to have spawned numerous spin-off groups that are likely to pose a serious threat to the world for many years to come. But withdrawing from that hapless country would help break the link between support for terrorism and popular resistance to US power, and Europe would at last be free to focus on the long haul of dealing with the very real threat of al-Qaeda. If this is appeasement, we need as much of it as we can get.
John Gray's Al-Qaeda and What It Means to Be Modern will be published in paperback by Faber & Faber in May