When an aid agency dug a new well in the heart of an Afghan village, the foreigners thought everyone would be grateful. The women of the village would no longer have to trudge to the river every day to fetch water. In fact the well was quickly destroyed, and this act of vandalism was not the work of Taliban saboteurs. Rather, it was the women of the village who destroyed it. Their walk to the river to fetch water had been their only chance to get out of the house and chat with their neighbours. The net result of putting a well in the centre of the village was to confine the women to their homes for even more hours of the day.
This is far from the only example of the western alliance blundering in Afghanistan, even after eight years in the country. The Swedish army in northern Afghanistan had a programme of well digging to improve water supplies. But they found that a new well in one village depleted the aquifer, depriving a neighbouring village of water and provoking tribal conflict. Now the Swedish army repairs existing wells.
For the past week attention has focused on how a double agent managed to blow himself up inside a US army base, killing seven CIA operatives who were said to include some of the top brains in the hunt for Osama bin Laden. This incident displayed an astonishing level of lax security and what looks, with hindsight, like culpable naivety. But it is still just a tactical error, and not the first time in the history of espionage that intelligence agents desperate to cultivate a "mole" have been tricked.
A broader and more serious issue which jeopardises the success of the whole Afghan campaign is highlighted by Major-General Michael Flynn, the intelligence chief for the allied military operation in Afghanistan. According to Gen Flynn, author of a blistering report on the failure of intelligence in that campaign, the US military is blind when it comes to understanding how the country works and how to win hearts and minds.
Military intelligence, he writes, is focused on targeting and killing Taliban commanders, rather than the real issue of finding ways to isolate the Taliban from the population. Killing Taliban fighters, he writes, will not win the war in Afghanistan, but only strengthen the ranks of the insurgents. Meanwhile, information on digging wells, the cost of building roads or ways to administer polio vaccines is unavailable to those who need it, "exposing all international efforts to ridicule for their ineptitude".
The only surprising aspect of Gen Flynn's report is that it has been published. It is not news that the US military has been focused on "force protection" - meaning preventing casualties by using the most devastating means to attack the enemy. Nor is it a revelation that 90 per cent of intelligence information - despite the layers of secrecy in which the product is wrapped - actually comes from news reports and other public sources. Nor should anyone be surprised that, in a counterinsurgency, intelligence briefs tend to tell the soldiers what they already know, while failing to give the commanders any information of strategic use.
This is not to say that intelligence is always smoke and mirrors. It can and does provide the means to understand and outwit the enemy. The British security services, after a slow start, penetrated the leadership of the Irish Republican Army (IRA), which provided the underpinning of confidence to proceed with an eventual peace agreement. During the US-Soviet crisis of 1962, plans of missile bases provided by a mole in Soviet military intelligence gave the US president John Kennedy the information he needed to interpret the Kremlin's plans in Cuba and react swiftly. The Israelis, thanks to controlling the borders, air space and economy of the Palestinian territories, can recruit legions of informants.
What links all these cases is the simple truth that it is easier to spy on your neighbour than on a society half a world away. The British and the Irish, and the Israelis and the Palestinians, are neighbours, while the Cold War adversaries shared the same cultural sphere and had decades to get to know each other. The Americans are often told to follow the example of the old colonial administrators of the British Empire. The British did not have any innate talent for dealing with the tribes of Afghanistan: the history of the First Anglo-Afghan War, where a 16,000-strong British army was utterly destroyed in 1842, shows that the learning process was painful. By the end of the Raj in 1947, however, administrators knew the Pashtun tribes as neighbours, as they had spent decades living among them.
It is worth recalling what Sir Olaf Caroe, the last British governor of North-West Frontier Province, saw as the requirements for the job: knowledge of Pashtu sufficient to talk to tribesmen, make a speech to the jirga, the tribal council, and to take up and participate in a running argument. Anything less, and the administration would be hobbled by the intrigues of interpreters and middlemen. This is an impossible requirement for the US military. Any officer who devoted his life, like Sir Olaf, to perfecting one Pashtu dialect would be committing career suicide. We do not have the time horizons of the old empires. Nevertheless, the principle set out by Gen Flynn stands: in a counterinsurgency you have to know the people among whom you are fighting. The fewer you kill, the more likely you are to win in the end. It may already be too late for the US military to change, after eight years of fighting blind. But to carry on in the same way will be just to throw away more money and waste more lives.