Pervasive corruption has also had an effect, with many of the schools that are listed on government budgets not actually functioning at all — “ghost schools” set up to allow officials to gobble up development aid without delivering any services.

“The problem is that so much of the effort has focused on the cities,” Mr. Wesa said during a visit to Panjwai last month. “We have to start from the village. If this library was in the city, we would have 100 visitors a day. But to me, the five visitors in the village are more important than the 100 in the city.”

Mr. Wesa’s organization began a national book drive last year, collecting about 20,000 books in a campaign that focused on social media. The competition for social status runs deep in this country, and Mr. Wesa banked on that to encourage contributions. Even the smallest donation of just a couple of books was celebrated online, with a picture of the donor and a word of gratitude.

The books have helped establish seven modest libraries in provinces with a reputation for some of the worst violence of the war: Helmand, Kandahar, Khost, Kunar and Wardak.

To Westerners, Panjwai, about an hour’s drive from the city of Kandahar, is most closely associated with a gruesome atrocity: the massacre of 16 civilians by an American Army sergeant who walked off his base before dawn one morning in March 2012. But for the residents, the place turned to hell years before that.

“Panjwai was like a bakery oven: You burned if you entered,” Mr. Haidary said. “If you said you were from Panjwai, people would get scared of you.”

Recently, though, the district has been relatively quiet. Even as the Taliban exert pressure in neighboring provinces, gobbling territory, the reach of government has been maintained in Kandahar, though it has often been disappointing or abusive.