“I look at them as humans and treat their bodies with respect because I believe that they were full of hope and life when they were alive,” he said. “I do not think about what they do. I become sad when somebody cuts a tree, let alone when people kill each other.”

For years he has searched for a replacement, someone to handle the physical challenge — turning the unyielding earth in sun and snow — and the mental tax the work exacts. They all turn him down. So the 52-year-old father of eight with a salt-and-pepper beard carries on, often with the help of a friend.

Three times a week, he visits the site, situated just past a mud village on the way out of town. He comes to tend to the graves and to ensure that no one has tampered with his work. He lives in fear that the Taliban will come to reclaim the bodies of their bombers. Only once has a family tried to collect remains.

“Normally no one claims the bodies,” he said. “Most of these people don’t have families.”

Having made peace with the worst of his work, Mr. Ahmad has found ways around the grim details. Every time there is a suicide attack, he says, his colleagues circle his desk at the municipal center in central Kabul, smiles edging up their faces.

“My colleagues make fun of me: ‘Khwaja, be prepared, there is another attack!’ ” he said.

“What can you do?” he continued. “Afghanistan has been at war for the last 30 years. One of the ways we have survived is a sense of humor.”