KHOJA OMERI, Afghanistan — For the past 11 months, the poplar-lined potato and wheat fields of this lush farming district were under Taliban control.

The mayor had been killed and the local government compound destroyed. Women were ordered to wear burqas and men not to trim or stylize their beards. Armed insurgents often appeared at farm gates, demanding to be fed. 

But just over two weeks ago, about 360 Afghan army soldiers and commandos, led by army Gen. Mushtaba Mobin and backed by Afghan air force planes, pushed into this district in embattled Ghazni province, about 100 miles southwest of Kabul.

In one morning, the government forces killed what Mobin said were more than 500 Taliban fighters, including members of their elite “Red Brigades,” and drove out the rest. 

“We got 161 of their Red Brigades, and we didn’t lose a single man,” Mobin boasted Saturday after an outdoor ceremony under a shade tree, attended by elders and officials from the largely ethnic minority Hazara district.

The army flew a group of journalists from Kabul to attend the event, which was heavy on pro-government praise and promises and decorated with posters of Afghan President Ashraf Ghani. 

“The people have nothing to worry about now. We are here to stay,” Mobin said. 

It may not be an easy pledge to fulfill.

Ghazni has remained a stubborn Taliban stronghold for years. In August, the insurgents besieged the provincial capital, burning down entire blocks, killing hundreds and forcing the cancellation of parliamentary election voting across the province in September.

In November, the insurgents unexpectedly attacked several rural districts of Ghazni, where they had long made peace pacts with local leaders. That prompted thousands of people to flee and brought protests in Kabul. Other districts remain cut off because of highway blockades.

In next-door Wardak province, the Taliban remains in full control of several districts. 

As peace talks with U.S. officials and Afghan leaders have faltered, the insurgents since March have been waging a stepped-up offensive, killing and wounding hundreds of Afghan forces and civilians. Moreover, several government counterattacks have been marred by mistaken aerial attacks that killed Afghan police or soldiers. 

But the Afghan security forces, operating under recently appointed senior officials with new ideas about how to fight a guerrilla war more effectively, have launched what they describe as an aggressive and coordinated campaign to recapture and hold on to Taliban turf in Ghazni and other conflicted regions. 

These officials, particularly Defense Minister Asadullah Khalid, have drawn praise from U.S. military officials here. The new generation of officers, many trained in the United States or Britain, have made changes in battlefield strategy, such as reducing the number of small, vulnerable checkpoints in rural areas and replacing them with fewer, larger units that can mobilize faster. 

“Things have completely changed,” Khalid said in a recent interview in his office. “We have changed from defensive to offensive. We are putting on more pressure, and we are coordinating better with other forces. We are no longer going in and just keeping districts for five days. We are going into places we can hold and start providing services to people, so they trust us more.”

That morning, Afghan newspapers reported that, in the previous 24 hours, at least 82 insurgents had been killed in government attacks in 15 scattered provinces. The news was not all good, with reports of the Taliban killing officials in one province and digging combat trenches in “vital areas” of another. In recent weeks, the insurgents have also staged attacks in numerous provinces. 

But Khalid, a former national intelligence chief who barely survived a suicide assassination attempt in 2012, seemed eager and confident.

Scrolling through his smartphone, he held out photos from recent battles in Ghazni, showing tangled heaps of Taliban corpses piled in trucks. He said security forces had freed several hundred prisoners from Taliban jails there and “not even 10 percent” of Ghazni residents support the insurgency. 

Ghazni’s ethnic makeup has complicated efforts to pacify the region. Large portions are inhabited by ethnic Pashtuns and Sunni Muslims, some of whom have sympathy for the Taliban. Other areas are inhabited by ethnic minority Hazaras and Shiite Muslims, some of whom have made peace deals with the insurgents while others have been prevented from voting in elections by insurgent threats. 

In Khoja Omeri, a district that is predominantly Hazara, a succession of local speakers — turbaned elders, young provincial leaders and a long-winded mullah — thanked the government forces for restoring security. In the next breath, they pleaded with visiting officials to help rebuild the district after months of Taliban occupation and fighting. 

The provincial governor, an appointee of Ghani, promised to bring back services to the struggling area and made an impassioned plea for the residents’ support and trust, asking them to “send your sons” to join the army and police. He also pledged that presidential elections would be held there as planned in late September and asked people to “please register and vote.” 

“Our heroes from the national security forces have taken back this district,” Gov. Wahidullah Karimzai said, while dozens of heavily armed soldiers and police surrounded the site. “You have a government now. Your problems are over. Public services will be restored. Do not worry about enemy propaganda. They cannot come here again.” 

One frail elder in a yellow turban walked slowly to the podium, his eyes watering but his voice gaining strength as he spoke. 

“The Taliban say they are waging jihad but they destroyed our roads, our schools, our clinics. Is that jihad? No!” he cried. 

“Now, for the first time, we see the police, the army, the security people here. We should pray for them, but we ask them to make the election safe and to please ask the Taliban to leave this war,” the elder begged. “What are they fighting for? Please, tell them to join the people, to build Afghanistan, to make peace.”