Taliban fighters have killed at least 20 Afghan soldiers in an attack on a checkpoint in Kunar province close to Afghanistan’s border with Pakistan.
At least one of the attackers was also killed and the Taliban told the BBC they had captured seven soldiers.
Afghan President Hamid Karzai postponed a planned visit to Sri Lanka on Sunday because of the attack.
The violence comes ahead of presidential elections that are due to be held next month.
The BBC’s Karen Allen in Kabul says it is one of the deadliest Taliban attacks against the army in the past year.
Gen Mohammad Zahir Azimi said “hundreds” of insurgents had been involved in the attack, which took place in the remote Ghazi Abad district of eastern Kunar province early on Sunday.
Heavy fighting is said to have continued for several hours.
Kunar Governor Shuja Ul Mulk told the BBC it was possible that Taliban infiltrators in the army had helped organise the attack.
Karzai’s office said in a statement: “The Afghan president is saddened by this tragic incident, and therefore he postponed today’s official trip to Sri Lanka.”
The government also confirmed that soldiers were missing, but put the number at six.
Militants have escalated attacks in recent months ahead of the withdrawal of foreign troops at the end of 2014.
Casualties among Afghan troops have been rising significantly since they took the lead in the war against the Taliban.
Security has been stepped up across Afghanistan ahead of April’s elections.
Eleven candidates are standing to replace President Karzai, who cannot seek re-election.
The Taliban has threatened to target the campaign.