CHAKARAN, Afghanistan — In one of the most remote places in Afghanistan, government forces this month managed to achieve something vanishingly rare these days: They clawed back not one but three districts from the Taliban’s grip.

But the cost was high, and the victory was tenuous. Even as the Afghan forces turned their attention toward defending their gains against fierce Taliban counterattacks in Badakhshan Province, paramilitary fighters were swamped by grief: One of their most revered commanders, Najmullah, was among the dead.

His men washed and wrapped his body carefully in white cloth, then loaded it onto a police pickup. They followed behind with heads bowed, weapons strapped across their backs and the morning sun glinting off their ammunition bandoleers.

A visit by New York Times journalists to Badakhshan, a far-northern spit of Afghanistan sandwiched by Tajikistan, China and Pakistan, showed the desperate nature of a fight in a place cut off from the rest of the country for months every year by winter storms and rugged terrain.