BAGRAM, Afghanistan — Nine years ago, Faiqullah Tajik helped sort laundry at Bagram Air Base, the largest American military outpost in Afghanistan. Mr. Tajik made $600 a month. He liked his job.

Mr. Tajik, 25, was laid off in 2011, along with thousands of other local residents of the nearby town of Bagram, as American forces started to withdraw from the country. Now he runs a shop adjacent to the main gate, selling American refuse from the sprawling facility: a discarded treadmill, used jugs, broken printers and computer fans. He makes $60 a month now, at least sometimes, he said.

“If the Americans leave, I will close my shop,” Mr. Tajik said. “And I will leave.” Since Mr. Tajik relies on the six-square-mile base for his livelihood, the Taliban will kill him if they return, he said.

The town’s location — straddling an important airfield that over the past 40 years has been occupied by two superpowers, the Soviet Union and the United States — has long kept Bagram in a sort of purgatory. The town depends on the base for its economy and also supplies it with a local work force, making it a prime target for the Taliban.