“I’m on the front lines now, and the fighting is very fierce,” Mr. Mohseni said. “The situation in the city is very bad — people are panicking and trying to find ways to flee.”

That Mr. Mohseni, a civilian official, was helping to organize the city’s defenses was an indication that government security forces there were in disarray. The governors of both Baghlan and Kunduz provinces were absent.

The Baghlan governor, Farid Baseem, left for India several days ago without informing provincial officials, Mr. Mohseni said. The Kundz governor, Abdul Jabbar Naemi, was in India on Sunday for medical treatment, said his spokesman, Ismatullah Muradi.

Mustafa Mohseni, a former police official and current militia commander in Pul-i-Kumri and Safdar Mohseni’s brother, said Taliban fighters had entered sections of the city as police officers and militiamen fought to hold them off. Mr. Mohseni said that the main highway to Kabul was closed and that residents had remained in their homes as the militants advanced.

“We heard the sounds of gunfire and mortars at 4 a.m.,” said Khadija Yaqeen, who lives in a section of Pul-i-Kumri under attack. Ms. Yaqeen, who leads the local women’s affairs directorate, said that electrical service had been cut, restored and then cut again, and that most cellphone service was down.

Government officials said on Sunday that Taliban fighters had been driven out of Kunduz by commandos and airstrikes, with many militants moving south to attack Pul-i-Kumri. Taliban fighters had been able to penetrate deep into Kunduz, briefly occupying the health department and a hospital, said Ehsanullah Fazli, the health director for Kunduz Province.

The fighting killed at least 20 security force members and five civilians, and wounded 85 others, the Ministry of Interior said in a statement. As many as 56 Taliban fighters were killed, the ministry said.