The attack in the Jurm district of Badakhshan province on Friday also left around a dozen soldiers missing, fuelling speculation that they had been captured by insurgents.
“Eighteen Afghan soldiers were martyred and eight of them were beheaded,” provincial spokesman Naweed Frotan told AFP.
“Our rescue operations are continuing to track down and bring back the security forces who went missing in the assault.”
The defence ministry confirmed the incident in a statement and said the fighting left a total of 33 Afghan soldiers dead, wounded or missing.
Twenty Taliban, including foreign fighters, were killed in the battle, deputy provincial police chief Sakhidad Haidar told AFP.
The Taliban claimed responsibility for the attack.
Afghanistan is bracing for what is expected to be a bloody summer push by the Taliban, set to be the first fighting season in which Afghan security forces will battle insurgents without full NATO support.
Taliban insurgents have stepped up attacks on government and foreign targets since Washington last month announced a delay in US troop withdrawals from Afghanistan.
NATO’s combat mission formally ended in December but a small follow-up foreign force has stayed on to train and support local security forces. – AFP