BAMIAN, Afghanistan — It was 3 a.m. when the loudspeaker at the village mosque crackled to life. An elder was calling everyone to come quickly. Taliban forces had just attacked a neighboring village, he said, and there was no time to lose.

Murtaza Nasiri, 23, recalled later that he was among those who immediately volunteered to help defend their village, Haider, located in the long-peaceful ethnic ­Shiite Hazara heartland of Ghazni province. Nasiri had grown up there, and he was studying to be an economist. 

He had never held a gun in his life. But suddenly he found himself being handed a Kalashnikov automatic rifle and following a group of men up the forested hills, where they began firing toward the insurgents. He had no idea how to handle the weapon, so someone else grabbed it.

“I had never experienced anything like this before,” Nasiri said, bursting into tears as he recounted the harrowing Nov. 6 attack. 

Nasiri’s family and at least 1,000 others have fled to Bamian, a city 200 miles to the north, from a ferocious assault on their villages across Jaghori and Malistan — two Hazara-dominated districts in Ghazni — as well as a third in next-door Uruzgan province. The violence, which continued for two weeks and left more than 100 dead, took residents and police by surprise. Afghan forces ultimately quelled the assault and pushed the Taliban out of the villages, but sporadic fighting continues.

Until now, Shiite Hazara communities in Ghazni had remained untouched. But as the Taliban, a mainly Pashtun and Sunni militant group, has expanded its territory across the country — leaving just 55 percent of Afghan districts under government control or influence — it has launched daring attacks to seize control of Hazara and Shiite strongholds in central Afghanistan.

The Hazara, the third-largest ethnic group in Afghanistan, suffered persecution by successive Pashtun-led regimes, including the Taliban, which executed them en masse. With the fall of the Taliban came opportunities for education and jobs for the minority group.

Before the recent attacks, the Taliban had steered clear of Hazara villages, in part because the militant group has little local support in those areas and would not be able to maintain control without it. But now that the Taliban controls large parts of the country, its attacks have become more daring.

In its most significant attack on a major city in three years, the Taliban besieged the provincial capital, Ghazni city, in August. According to local leaders, insurgents had met with Jaghori elders in recent months, asking them to accept Taliban rule, but had been strongly rejected.

The unexpected attacks came as Taliban leaders expressed interest in reconciliation and attended peace discussions in Moscow and Qatar. Analysts said they expect the insurgents to keep up an aggressive battlefield campaign to drive a harder bargain.

In Nasiri’s village and several others, local armed men held off the Taliban fighters for several days while the government sent in hundreds of army troops, including special operations forces, to counter the wave of attacks.

But on Nov. 11, local witnesses and officials said, a single Taliban raid on Hotqol village left 23 Afghan special forces members dead, along with dozens of local fighters. Villagers interviewed in Bamian described seeing bodies piled onto a truck. Many said they decided to flee soon after.

One of those who made the hazardous drive north, over rugged roads and mountain passes in freezing cold and rain, was Shafiqa Rezai, 29. A midwife in Angori village, she was on night duty Nov. 6 when the gunfire began. By early morning, she said, three corpses and 18 wounded people had arrived. 

After hiding at home for a week while the fighting came closer, Rezai said, she and her family decided to escape. They drove for three days and nights in a convoy of six cars before reaching Bamian, a Hazara stronghold. 

“I cried all the way,” she said. “We left everything behind.”

They were greeted by local volunteers, registered as displaced people and directed to residents who helped many of them with food, shelter and coal stoves. Local agencies also offered medical checkups and blankets. 

In interviews here last week, displaced people from Jaghori and Malistan described their home districts as havens of calm and development for the Hazara during the past 17 years, with almost no interference from insurgents. They said there was little crime and schools for both boys and girls.

That tranquil atmosphere was abruptly shattered with the recent attacks. Schools and markets closed, cellphone towers were destroyed, and some village militia fighters are still missing.

One militiaman who fled to Bamian, Habibullah Ahmadi, 48, said he had lost faith that the government would protect them. Several others said that Taliban representatives had told villagers they wouldn’t be harmed if they stayed indoors but that nobody trusted them.

Some of the displaced said they were thinking of resettling in Bamian, where they have been welcomed in homes and mosques. After the Taliban captured Hotqol, the managers of an orphanage in the nearby Jaghori district center managed to transport all 120 children to a branch of the same organization in Bamian, where they may remain.

“We were really worried the insurgents might harm or even take the children” if the district fell, said Ghulam Hussain Matin, director of the Shuhada nonprofit, which runs both orphanages, as a group of children played volleyball in the yard outside. “The sounds of explosions and bullets can also do them psychological harm.”