For years, violent Islamist groups were allowed to settle in Britain, using the country as a base to carry out attacks abroad. This was tolerated in the belief that they would not bomb the country where they lived and that, as long as they are here, the security service would be able to infiltrate them. At the same time mosque after mosque was taken over through intimidation by the fundamentalists. Police and others in authority refused pleas from moderate Muslims with the excuse that they did not want to interfere.

There was even a name for this amoral accommodation: the "covenant of security". We now know that jihadists will indeed blow up their home country and that the security agencies signally failed to infiltrate the terrorist cells while they had the chance.

The part played by officials in the growth of terrorism in Britain is a relatively small-scale affair compared to what went on abroad. Successive UK governments had nurtured and promoted extremists for reasons of realpolitik often at a terrible cost to the population of those countries. Mark Curtis, in his book on "Britain's collusion with radical Islam", charts this liaison. He points out how reactionary and violent Muslim groups were used against secular nationalists at the time of empire and continued afterwards to back UK and Western interests.

Download the new Independent Premium app Sharing the full story, not just the headlines

The price for this is now being paid at home and abroad. I am writing this review in Helmand, where a few days ago I went on an operation with British and Afghan troops against insurgents whose paymasters, across the border in Pakistan, have been the beneficiaries of US and British largesse.

Curtis points out that two of the most active Islamist commanders carrying out attacks in Afghanistan, Gulbuddin Hekmatyar and Jalalludin Haqqani, had particularly close contacts with the UK in the past. Hekmatyar met Margaret Thatcher in Downing Street when he was a favourite of MI6 and the CIA in the war against the Russians. Haqqani, while not the "Taliban's overall military commander fighting the British" as Curtis says (he runs his own network parallel to the Taliban), was viewed as a highly useful tool in that conflict.

The Western use of the Mujaheddin as proxy fighters is well documented. It resulted in the spawning of al-Qa'ida, the spread of international terrorism, and the empowering of ISI, the Pakistani secret police, who became their sponsors. Curtis examines the lesser known by-products of this jihad: the dispatch of Afghan Islamist veterans, with the connivance of Britain and the US, to the wars in the Balkans and the former Soviet republics in central Asia, and ethnic Muslim areas of China. Vast sums of money from the West's great ally, Saudi Arabia, helped fund the Reagan administration's clandestine war in support of repressive military juntas in Latin America while, at the same time, buttressing the aggressive Wahabi faith embraced by many terrorist groups.

The use of hardline Islam by the West was particularly prevalent at the time of the Cold War. In many instances, however, the targets for destabilisation were not Communist regimes but leaders who had adopted left-wing policies deemed to pose a threat to Western influence and interests.

The UK attempted to combat "virus of Arab nationalism", after Gamal Abdel Nasser came to power in Egypt and nationalised the Suez Canal, by forging links with the Muslim Brotherhood, an organisation involved in terrorism. The nationalisation of the Anglo-Iranian Oil Company by the democratically elected Iranian government of Mohammed Mossadeq led to a British-American organised coup which was facilitated by Ayatollah Seyyed Kashani, one of whose followers was the young Ruhollah Khomeini. In Indonesia, the removal of Ahmed Sukarno in another military coup by the UK-US was carried out with the help of Darul Islam. Its followers went on to massacre socialists and trade unionists.

In each of these cases the clandestine backing of Britain and the US strengthened Islamist groups at the expense of secular bodies and moderate Muslims. These groups then went to form terrorist groups whom the West would later have to confront in the "War on Terror".

Here in Afghanistan, its most ferocious and violent front, moves are once again under way to negotiate with Islamists as the West seeks an exit strategy from a conflict increasingly costly in lives and money. The UK, more than the US, has been pressing President Hamid Karzai to come to an agreement with the insurgents. This goes beyond reintegrating the foot soldiers - a sensible policy - to a settlement with the leadership of Haqqani, Hekmatyar and Mullah Omar. The Pakistani ISI is eager to help broker such a deal and Karzai, who no longer believes Western politicians have the stomach for a long-term military commitment, is veering towards this as the option which will keep him in power.

The Tajiks, Uzbeks and Hazaras, minority communities who had fought the Pashtun Taliban in the past, warn this will re-ignite the civil war. Human rights groups fear hard-won civil liberties, especially for women, will be sacrificed in order to cut a deal with the Islamists. For Britain and the West the result is likely to follow the past pattern of the history of involvement with extremists: short-term gain followed by long-term loss as the international jihad continues to grow and gain ground.

Kim Sengupta is Defence Correspondent of 'The Independent'