Taliban in a statement said on Tuesday that they have released 58 soldiers who were captured in Bala Murghab district in northwestern Badghis province.
Taliban said in the statement that the decision was made by their leaders.
According to the Ministry of Defense, 58 other forces who crossed the border into Turkmenistan returned home on Monday.
The forces came under attack by Taliban militants in Bala Murghab, which shares border with Turkmenistan, in the northwest of Afghanistan, almost two weeks ago.
The Ministry of Defence said women and children also accompanied the soldiers when they crossed the border into Turkmenistan after they came under pressure by Taliban militants.