Afghan forces launched a lightning operation in northern Kunduz province on Monday, rescuing 149 people, including women and children, abducted by the Taliban just hours earlier, officials said.
By mid-afternoon, fighting was still underway 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.
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, according to Nasrat Rahimi, deputy spokesman for the Interior Ministry.
Rahimi said that after Afghan security forces freed 149, the insurgents were still holding 21 hostages from the buses. He added 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 cease-fire 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 traveling to the capital, Kabul, said Abdul Rahman Aqtash, police chief in neighboring Takhar province.
Ghani's call for the truce, made during celebrations Sunday of the 99th anniversary of Afghanistan's independence, said "the cease-fire 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 cease-fire, Akhunzadah said the insurgents remain committed to "Islamic goals," the sovereignty of Afghanistan and ending the war.
For his part, Ghani said he hoped extensions could also be agreed upon to make the cease-fire last until Nov. 20, which will mark the birth anniversary of the Prophet Muhammad.
The government had previously announced a cease-fire with the Taliban during the Eid al-Fitr holiday in June. The Taliban accepted that three-day truce but later rejected a call by the president to extend it.
Earlier this month, the Taliban launched a major assault on the eastern city of Ghazni, just 120 kilometers (75 miles) from Kabul and the capital of a province with the same name. Afghan security forces battled the militants inside the city for five days, with the U.S. carrying out airstrikes and sending advisers to help the Afghan ground forces, until the Taliban were routed from Ghazni.
The battle for the city killed at least 100 members of the Afghan security forces and 35 civilians, according to Afghan officials. The heavy casualties underscore the challenges the government in Kabul faces since the U.S. and NATO officially ended their combat mission at the end of 2014. Since then, American forces, now in a training and advising role, have repeatedly come to the aid of Afghan forces.
Associated Press writer Rahim Faiez contributed to this report.