The first time I visited Afghanistan, in 2002, I found a country devastated after nearly a quarter-century of war. It lacked all the basics -- schools, hospitals, roads and electricity.

But by the time I returned for another reporting stint three and a half years later, that period had come to be known among American diplomats as "the good old days." Back then, in that first spring after the Taliban's fall in December 2001, the country exuded a palpable sense of optimism, even giddiness. By the time the winter of 2005 closed in, frustration had replaced hope. Kabul had Western-style malls and five-star hotels, but the life of the average Afghan seemed to be getting worse as a violent rebellion by the resurgent Taliban mounted and critical reconstruction projects stalled.

So what went wrong in between? Some of the answers are supplied by the former National Public Radio reporter Sarah Chayes in her sharply observed, fearlessly told memoir of life in Afghanistan after the Taliban, The Punishment of Virtue.

Her instrument of choice in recounting this story is the microscope, not the telescope. This is not a sweeping history. Instead, she sticks to what she sees and hears from her perch living among Afghans in Kandahar, the deeply traditional city and former Taliban stronghold that is at the heart of the country's past, present and future.

But what a perch it is. Unlike many Westerners in Afghanistan, Chayes throws herself into the culture, learning Pashto, living with a family of 21 and wearing down the already rutted roads as she drives herself around town. She also confronts mysterious death threats and ends up sleeping with a Kalashnikov rifle propped beside her bed.

Chayes first enters Kandahar in the days after the Taliban's fall. She does so as a journalist, having volunteered to leave her cushy job as an NPR correspondent in Paris because the Sept. 11, 2001, terrorist attacks inspired her to do more than "filing a seemingly endless series of food stories." Though Chayes had covered war before, in the Balkans, she saw her assignment to Afghanistan as something bigger -- a chance to do her part in mediating between the West and Islam even as others spoke ominously of an unavoidable clash of civilizations.

What she found was a story infinitely more complex than the standard fare of American troops vs. Taliban and al-Qaeda terrorists. Early on, she discovers that the United States had handed over control of Kandahar to a local thug named Gul Agha Shirzai. Shirzai had been governor before -- during a period so anarchic and bloody that city residents actually welcomed the takeover by the puritanical Taliban. Now, he was governor again, despite the wishes of President Hamid Karzai, who had also been handpicked by the United States. "The Taliban have scarcely fallen," Chayes writes, "and already U.S. policy seems at cross-purposes with itself." But her NPR editors aren't interested in that story. They want "Mullah Omar sightseeing" (as she calls descriptions of the country's self-proclaimed emir's "tacky" lair) and other tales from the Taliban's awful reign.

So Chayes quits journalism but not Afghanistan. She stays in Kandahar as field director for Afghans for Civil Society, a nonprofit group set up by Karzai's brother Qayum. Her first project is rebuilding a small village on Kandahar's outskirts where U.S. bombing had pulverized a third of the houses. Through her efforts, she glimpses the dysfunction of the American-led reconstruction. U.S. officials endlessly rotate in and out of the country, never staying long enough to learn their way around. Plans are made and then scrapped. Rules are unbreakable, except when they're broken. Chayes writes that the inefficiencies become even more acute after the 2003 U.S. invasion of Iraq, when Afghanistan's reconstruction falls even further down the priority list.

But she sees a more fundamental problem than bureaucratic bungling. U.S. support for Afghanistan flows through Afghan leaders, but when those leaders are warlords such as Shirzai, the aid is not just wasted but actually works against U.S. interests. He and his cronies get rich off U.S. funds and fool the Americans into thinking they are keeping the city safe. Meanwhile, Chayes contends, Kandahar's thugs are also taking money from Pakistan, which she sees as an ostensible U.S. ally that is deliberately undermining Afghan security. To the average Kandahar resident, America's presence became synonymous with the brutality and corruption of its local warlord proxy. "American policy in Afghanistan was not imposing or even encouraging democracy, as the U.S. government claimed it was," Chayes writes. "Instead, it was standing in the way of democracy. It was institutionalizing violence."

That sense of outrage courses through the book, and by the time Chayes is done, many readers will feel the same way. She even directs her venom at the one man she had thought could lift Afghanistan from the ashes: President Karzai, whom she ultimately blames for lacking the spine to stand up to the warlords.

Yet Chayes concludes that Afghanistan is not a lost cause. Her story has one true hero: the mighty police chief, Muhammad Akrem Khakrezwal, a man who actually uses his position to make the cities of Kandahar, Kabul and Mazar-i-Sharif safer, not to profit personally. Unfortunately, he gets little support from the central government or the Americans. The book begins and ends with his assassination.

For Afghanistan's sake, one can only hope there are more out there like him. ·

Griff Witte is a Washington Post staff writer.