EVEN as the dining room smouldered, soldiers moved about taking fingerprints and scanning eyes of the corpses of Taliban fighters. The ghoulish ritual followed an attack, on June 21st, on a restaurant beside Qargha Lake in Kabul. After the scans, the information was compared with a biometric database.

Gathering such data, even from the dead, is now standard practice in the Afghan war. Soldiers learn that usable scans can be harvested as late as six hours after death, depending on the heat. Investigators were confident of finding a match at Qargha Lake, and did so. Their success underlines the growth of the database and the ambition of those behind it.

In this case an unnamed suicide-bomber had been scanned two years earlier, in Logar province, because he was looking suspicious, said Lieutenant-Colonel Mohammad Anwar Muniri, who leads the Afghan programme. However, he was not detained. A list of “martyrs” released by the Taliban after the attack in Kabul confirmed he was from that province.

His details could equally have got into the database in other ways. Few of Afghanistan's 30m people have a birth certificate, a second name or can read. Yet America's army and the Afghan government have collected digital records of more than 2.5m of them. Anyone arrested or imprisoned, or who seeks to join the army or police, is scanned. So are those, such as labourers, who attempt to get into a coalition military base. Each is checked against watchlists of suspects. Last year biometric machines were also put at all border crossings. In hotly contested areas any “fighting-age males”, meaning those between 15 and 70, may be scanned compulsorily.

Some patrols call all men from a village out of their homes and line them up by a mosque to be logged. At other times buses are stopped arbitrarily and all the men are taken off and scanned.

Elsewhere such intrusions would have caused an outcry. But few Afghans, so far, have protested. American officers praise the technology as a helpful counter-insurgency tool: if opponents can be identified, they can be separated from the wider, law-abiding populace. They cite examples of its usefulness. Nearly 500 Taliban prisoners tunnelled out of Kandahar's Sarposa prison last year, but they had previously all been scanned. Within a month 30 had been recaptured because of random biometric checks.

The data are passed on beyond Afghanistan, to America's army, the FBI and the Department of Homeland Security. Agreements to share data exist with dozens of allied countries. American soldiers in Ghazni once described scanning a dead insurgent, then two days later getting a call from the CIA to say that his record matched someone first scanned in Iraq.

Yet as the system grows, so do worries about it. It is involuntary and shrouded in secrecy. It is easy to come across Afghans who claim that they were wrongly denied foreign visas or jobs after a biometric scan flagged up their presence on some watchlist. Evidence held against them is rarely divulged, nor is it clear how they can challenge it.

“There is a vetting process to be put on a watchlist,” says Sergeant-Major Robert Haemmerle, of the American army's Afghanistan biometrics programme. “It's not just a matter of ‘I don't like this guy'. There is a deliberate policy and process to ensure that people's rights are respected, that it's not abused.”

Yet those policies and processes are kept classified by NATO and America's Defence Department. Jennifer Lynch, a lawyer at the Electronic Frontier Foundation, a group based in San Francisco that keeps a watch on how digital technology encroaches on civil freedoms, also questions the quality of the data. She fears that scans done quickly in the field, or by inexperienced technicians, could lead to cases of mistaken identity.

Neither Afghan nor American officials have described their ultimate plans for the project, nor whether they want to log the whole population. Talk of a new national identity card has fallen quiet. But the more people who are scanned, the more powerful the database becomes.