KABUL, Afghanistan — Taliban forces have captured the center of a hotly contested district in northern Afghanistan, but Afghan forces are preparing for a counterattack, a government spokesman said Sunday.

Afghan security forces pulled out of the center of Char Dara district — located about 150 miles north of Kabul — in order to minimize casualties, said Abdul Wadood Wahidi, spokesman for the governor of Kunduz province.

“The government offices and police station are in the hands of the Taliban,” Wahidi said. “Fresh reinforcements are arriving from Kabul and have started the counterattack.”

Wahidi said 17 attackers had been killed and 21 wounded in the firefight, which began Saturday. Three Afghan security personnel were also killed and six wounded, he said.

Taliban spokesman Zabihullah Mujahid confirmed the deaths of four Taliban fighters. In a statement, he claimed that 24 army and police personnel were killed and 19 wounded. Twenty-five government troops were captured alive, the statement said.

The attack came as the Taliban rejected a unilateral cease-fire announced Thursday by the government, at the start of the holy month of Ramadan. Mujahid claimed government troops were in fact continuing their attacks on the insurgents despite the announced truce.

The Taliban launched their summer offensive in April — the first fighting season since most U.S. and NATO forces were withdrawn following the end of the combat mission in 2014. Although there are still about 13,000 Western troops in the country, their main mission is to train and assist the Afghans, and they have mostly stayed out of combat operations.

Much of the fighting in this year’s campaign has taken place in Afghanistan’s northern regions. The capital of Kunduz province was nearly overrun in a sudden attack in April, but was saved by government reinforcements flown in from other parts of the country.

Earlier this month, several hundred insurgents overran Yangam district, a remote region in Badakhshan province in northeastern Afghanistan. But they withdrew within a week after government reinforcements mounted a counterattack.

Some northern areas, such as Char Dara, have retained a strong Taliban presence throughout the 14-year war.

In 2009, German troops launched a massive effort — their biggest offensive action since World War II — to rid the district of insurgents, but they never were able to dislodge the guerrillas and the campaign was seen as a failure.

Zubair Babakarkhail contributed to this report.

Sign Up for Daily Headlines

Sign-up to receive a daily email of today’s top military news stories from Stars and Stripes and top news outlets from around the world.

Sign up