The ambush came despite assurances by the Taliban to Washington last week that they would reduce the bloodshed, AFP reported.
Security forces were attacked overnight Tuesday in Takhar province and fighting was still going on, said Jawad Hejri, a spokesman for the governor, who put the death toll so far at 25.
"The Taliban had taken positions in the houses around the area. They ambushed our forces who were there for an operation against the enemy," he said.
Takhar provincial health director Abdul Qayoum said 34 security personnel had been killed -- including the deputy police chief of the province.
The Taliban have so far not commented on the attack.
Despite opening peace talks with the Afghan government in Qatar, the hardline group has only increased violence in Afghanistan in a bid to wield leverage in the negotiations.