Taliban militants have killed several Afghan security forces in fresh attacks on several security checkpoints in the northern Sar-e-Pul Province, according to officials.

In one of the January 1 attacks in the Sayyad district of the province, local police chief Khalil Khan was killed along with four other officers, a source told RFE/RL.

The dpa news agency quoted provincial council member Mohammad Asif Sadiqi as saying a high-ranking provincial official with an Afghan spy agency and an army company commander were also killed in the attacks on two security posts, which it said left 23 Afghan security forces dead.

Gunbattles raged for several hours in the Sayyad district as heavy artillery fire by Afghan troops trying to beat back the insurgents sent locals fleeing for safety.

AP quoted Taliban spokesman Qari Yousof Ahmadi as claiming responsibility for both attacks.

The violence comes a day after Iran said a Taliban delegation made a rare visit to Tehran for talks with a senior Iranian official on efforts to end Afghanistan's 17-year-long war.

It also occurred just over a week after U.S. President Donald Trump ordered the Pentagon to prepare for the withdrawal of 7,000 American troops deployed in Afghanistan, about half of the U.S. contingent in the country.

Many observers warned that the partial withdrawal could further degrade security and jeopardize possible peace talks with the Taliban aimed at ending its insurgency.

U.S. forces make up the bulk of the NATO-led Resolute Support mission that is training and advising Afghan security forces in their fight against the Taliban and Islamic State militants.

The U.S. military also has some 7,000 troops deployed in a separate U.S. counterterrorism mission.

With reporting by AP and dpa