IN PECH VALLEY, AFGHANISTAN Earlier this year, Lt. Col. Joseph Ryan concluded that his 800-soldier battalion was locked in an endless war for an irrelevant valley.

"There is nothing strategically important about this terrain," said Ryan, 41, a blunt commander who has spent much of the past decade in combat. "We fight here because the enemy is here. The enemy fights here because we are here."

Ryan's challenge for the past several months has been to figure out a way to leave the Pech Valley, home to about 100,000 Afghans, without handing the insurgents a victory. This fall he launched a series of offensives into the mountains to smash Taliban sanctuaries. His goal is to turn the valley over to Afghan army and police units who would work out their own accommodation with bloodied insurgents.

"The best thing we can do is to pull back," he said, "and let the Afghans figure this place out."

On the afternoon of Nov. 12, Ryan's plan reached a critical moment. A company of his soldiers was clearing a village in the mountains when it came under attack. One American and two Afghan soldiers were killed.

Ryan ordered his troops to pursue the enemy deeper into the mountains, kicking off a gun battle that spanned six days and resulted in the deaths of more than 60 Taliban fighters, U.S. military officials said.

Six of Ryan's soldiers and one Army Ranger from another unit were killed. "Losing those soldiers was a huge price," said Maj. Gen. John F. Campbell, the senior commander for eastern Afghanistan. "What they did was very important. This was a significant disruption of the enemy's network."

For Ryan's soldiers, the outcome wasn't nearly as clear.

In today's wars in Afghanistan and Iraq, victory is often a moving target. When U.S. troops surged into Iraq in 2007 after several years of missteps, U.S. commanders defined winning primarily as a reduction in the sectarian killings that had brought the country to the brink of civil war.

In some parts of Afghanistan, troops are fighting to build a government and Afghan security forces in the midst of an effective and deadly insurgency. In other places, like the Pech Valley, where there is little history of governance and a deep suspicion of outsiders, U.S. goals have been scaled back. These troops are fighting so that Afghan officials can figure out a way to coexist with a committed and ideological resistance.

In the days after their battle in the mountains, some of Ryan's soldiers questioned whether their commander - a steady officer carrying out a thankless mission - had asked too much of them in pursuit of a fleeting victory. A few young soldiers struggled with a sense of betrayal.

Letters to loved ones

"I really wish I was never put in a position where I had to write a letter like this," 1st Lt. David Broyles wrote in a small leather-bound notebook his wife had sent him.