Afghan forces have rescued 149 people in northern Kunduz province who had been abducted by the Taliban just hours earlier.

By mid-afternoon, fighting was still under way in the area to free 21 remaining hostages, officials added.

The operation was a boost for Afghan forces, which have struggled to contain a resurgent Taliban on battlefields across the country.

Afghanistan Ceasefire
Taliban fighters gathering with residents to celebrate a three-day ceasefire in June (Ramat Gul/AP)

On Monday morning, the Taliban ambushed a convoy of three buses travelling on a road in the Khan Abad district, and forced everyone to come with them.

Interior ministry spokesman Nasrat Rahimi said that after Afghan security forces freed 149 people, including women and children, the insurgents were still holding 21 hostages from the buses.

He said at least seven Taliban fighters have been killed in the fighting so far.

The ambush came despite Afghan president Ashraf Ghani’s announcement of a conditional ceasefire with the Taliban during the Muslim holiday of Eid al-Adha this week.

The Taliban have stepped up their assaults in recent months, seizing entire districts across Afghanistan and regularly carrying out large-scale bombings and attacks that have killed scores of people.

Esmatullah Muradi, spokesman for the provincial governor in Kunduz, also confirmed the rescue of the hostages.

According to Mohammad Yusouf Ayubi, the head of the provincial council in Kunduz, the Taliban were likely looking for government employees or members of the security forces who usually go home for the holidays.

All the passengers on the buses were from Badakhshan and Takhar provinces and were travelling to the capital, Kabul, a police spokesman said.

Mr Ghani’s call for the truce, made during celebrations on Sunday of the 99th anniversary of Afghanistan’s independence, said “the ceasefire should be observed from both sides, and its continuation and duration also depend on the Taliban’s stand”.

On Saturday, the leader of the Afghan Taliban, Maulvi Haibatullah Akhunzadah, said that there will be no peace in the country as long as the “foreign occupation” continues.

He reiterated the group’s standing position that the country’s 17-year war can only be brought to an end through direct talks with the United States.

In a message released on the occasion of Eid al-Adha, and without mentioning any ceasefire, Mr Akhunzadah said the insurgents remain committed to “Islamic goals,” the sovereignty of Afghanistan and ending the war.

For his part, Mr Ghani said he hoped extensions could also be agreed upon to make the ceasefire last until November 20, which will mark the birth anniversary of the Prophet Muhammad.