KUNDUZ, Afghanistan — The first two times the Taliban overran the city of Kunduz, Col. Sayed Sarwar Hussaini survived the carnage, just as he had many attacks and suicide bombings before.

As the spokesman for the local police, his job was essential: The long Afghan war is increasingly fought as much on social media pages and television screens as it is on the battlefield. Colonel Hussaini, 36, would spar with the Taliban, telling a radio station that all was fine, promising a television channel that Afghan forces had repelled an assault.

On Saturday, the Taliban came for the northern city for the third time in four years, launching a pre-dawn offensive even as they continued peace talks with American diplomats. Their advances were largely stemmed by the end of the day, as Afghan commandos flooded Kunduz and airstrikes hit Taliban positions.

But as night fell over the battered city, Colonel Hussaini was not so lucky. He was among the roughly 30 dead on the government side, most of them security forces. At least 36 Taliban fighters were also killed, Afghan officials said.