The attack took place in the eastern province of Paktia in the early hours of Friday.
Taliban spokesman Zabihullah Mujahid said on Twitter that the militant group had conducted the attack against “the newly established posts of the enemy in Dande Patan district of Paktia province” and had killed 14 soldiers.
He said the Afghan government “has been recently trying to expand its rule” in territories held by the Taliban, adding that two militants were also killed.
Afghan security officials confirmed that the attack had killed 14 security forces.
But Dande Patan District Governor Eid Mohammad Ahmadzai told AFP that 15 security forces and 20 Taliban militants had been killed in the attack.
Some 14 Afghan security forces were killed in two other attacks on separate checkpoints blamed by officials on the Taliban on Thursday.
The attacks came shortly after a three-day ceasefire offered by the militant group ended late on Tuesday.
Despite the renewed violence, Afghan authorities are pressing on with efforts to have the ceasefire extended.
“The détente that started during Eid al-Fitr continues despite reports of scattered incidents to the contrary,” Afghanistan’s National Security Council spokesman Javid Faisal tweeted.
“A ceasefire is a complex operational undertaking that requires significant and ongoing coordination to avoid incidents. Those efforts will continue,” he added.
The unexpected ceasefire offer by the Taliban and a consequent, brief lull in violence had raised hopes that peace talks between the militants and the Afghan government could begin soon.
Kabul responded to the ceasefire by initiating a process to release up to 2,000 imprisoned Taliban militants as a goodwill gesture.
Some 900 Taliban inmates were released on Tuesday.
And the militant group released 80 Afghan policemen and soldiers it had been holding captive on Thursday.
The exchange of prisoners kicked off under a deal between the Taliban and the United States, which was signed in the Qatari capital, Doha, on February 29.
Under the deal, the Taliban agreed to halt their attacks on international forces in return for the US military’s phased withdrawal from Afghanistan and the prisoner exchange with the government in Kabul.
The Afghan government, which was not a signatory to the accord, was required to release up to 5,000 Taliban prisoners. The militants, for their part, were obliged to free 1,000 government captives.
Kabul had previously released some 1,000 Taliban prisoners, while the Taliban had freed around 300 Afghan security force personnel.