FAIZABAD, Afghanistan — They paced aimlessly inside a guarded compound, stepping over their beard and hair clippings on the ground. Ninety-eight Taliban in all — fighters as young as 16 and as old as one white-bearded veteran of 65.

They had all laid down their weapons and pledged loyalty to the Afghan government. But the reasons for that depended on who was telling the tale — and illuminated some of the complexity of a war in which side-switching is common.

The Afghan military says these Taliban fighters quit to try to save their lives after Afghan forces retook three districts from the Taliban during desperate, pitched battles in the northeastern province of Badakhshan in September.

The fighters had been told by the head of the national intelligence agency in the province that they were free to return to civilian life if they renounced the Taliban.