Esmatullah, whose two brothers were returned by Mr. Hakim last year after the Taliban executed them, said his family revered the man. “My elderly mother doesn’t pray for her sons first,” said Esmatullah, who goes by one name. “First she prays for him. That’s how much she admires his work.”

Mr. Hakim’s work began by chance after the death of a famed Taliban commander in Zhare, his native district. The insurgents wanted the body of their leader returned, and neighbors suggested they ask Mr. Hakim, who was volunteering for the Afghan Red Crescent at the time.

Mr. Hakim decided to give it a try. He drove to the district center and made his entreaty. As he waited, the district police commander had a question of his own for Mr. Hakim: Why had he never offered to collect the government bodies?

“I told them it never occurred to me to do any of this,” he said with a wry smile. “I wasn’t even sure I wanted to do this for the Taliban.”

Eventually, the government agreed to release the body, but on the condition that the Taliban would do the same.

“I wasn’t expecting this war to go on so long or to carry so many bodies,” Mr. Hakim said, plucking at a set of green prayer beads. “I thought it would only be these first few.