KABUL, Afghanistan – Gunfire rang out from every hedgerow, hut and irrigation ditch, the vines so thick that U.S. Special Forces soldiers couldn't even see the muzzle flashes from the AK-47s aimed their way.
In that battle, "The future of NATO, and of Afghanistan, hung in the balance," Canadian Brig. Gen. David Fraser, then the southern NATO commander, wrote in a letter of congratulations to U.S. Special Forces. He said a NATO loss to the Taliban would have had significant consequences for Afghanistan and the West.
• More coverage of the struggle for stability is available in FOXNews.com's Afghanistan Center.
That was last fall, during an operation to clear Kandahar province's Panjwayi district of about 2,000 Taliban fighters in the alliance's largest-ever ground battle. Now comes another challenge: to fireproof the territory against a Taliban resurgence by building up local security forces and showing off the benefits of a Taliban-free environment.
The difficulties were highlighted last week by the Taliban capture of Musa Qala, a village in neighboring Helmand province. British forces and the Taliban had withdrawn from the village in October after an accord was reached between villagers and the Afghan government. Now NATO is talking of mounting another offensive to take it back.
The operation to drive the Taliban out of Panjwayi was a costly one: more than 500 militants were killed, along with 20 NATO troops, 20 Afghan police and a soldier. But 48 civilians also died, many from NATO bombs or gunfire when Taliban fighters occupied their homes, according to Dawood Ahmadi, the governor's spokesman. About 20,000 families fled on trucks, carts and donkeys, leaving watermelons and grapes to rot.
But today, as American Special Forces Humvees roll through acre after acre of barren winter grape fields, children in dirty clothes and no socks wave and smile. About 70 percent of the families have returned, and NATO is counting on them to help head off a Taliban counteroffensive expected in the spring.
U.S. Special Forces soldiers are training the Afghan army and police, and the Canadians are reopening schools and running medical clinics.
In Afghanistan, as in Iraq, it's not enough to drive out insurgents; long-term security means building lasting economic structures, says Mustafa Alani, director of security and terrorism studies at the Dubai-based Gulf Research Center. In a telephone interview, he said he's not convinced that is happening in either Afghanistan or Iraq.
A "massive" development campaign started in Panjwayi last month, said Shaheer Shahriar of the Ministry of Rural Rehabilitation and Development. He said work has begun on 16 of an expected 50 projects and the ministry has $18 million in U.S. and Canadian aid to spend on development projects in Kandahar province.
Lt. Col. Donald C. Bolduc, commander of U.S. Special Forces in southern Afghanistan, cautioned that militants were likely to return to Panjwayi, and "If we do not get the Afghan national security forces in place before that, it will be very problematic."
But he said things have improved markedly since last fall when some 2,000 fighters moved into the district, posing a major threat to Kandahar, Afghanistan's second city and a former Taliban stronghold 15 miles to the east.
NATO and U.S. Special Forces entered the region in September and found a "well-equipped, well-trained force, not like we've seen before," said Rusty, a Special Forces captain who, under Special Forces embedding rules, cannot be fully identified.
Outnumbered Special Forces soldiers repelled Taliban attacks on a hilltop school in Sperwan Ghar that now serves as a NATO base. Aircraft supported U.S. and Canadian ground forces, but almost every fighter jet ran out of ammunition.
Kandahar Gov. Asadullah Khalid said Panjwayi was weak because it had only 45 police and not enough soldiers. Today it has 150 policemen and the situation is "completely changed," he said, noting that Panjwayi hasn't had a roadside or suicide bombing in over a month. He said 90 percent of the population supports the government, while the other 10 percent still back the Taliban and drug lords.
Col. Ahmed Habib, an Afghan army commander, said the Taliban works by sowing fear; in December fighters beheaded two men in the village of Talukan. But he said more Afghans now trust the security forces, telling them when roadside bombs are planted.
On a recent morning patrol, Special Forces soldiers based in Sperwan Ghar passed dozens of huts where farmers dry grapes into raisins. Favored by Taliban fighters because bullets cannot penetrate the thick mud walls, many were destroyed by airstrikes.
Troops also plowed new roads through grape fields, upsetting some farmers. Mohammad Khan, 45, said NATO forces offered him money for his ruined land, but not its full value. "They destroyed all my land, and they said I can either take the money or not," he said.
But Mohammad Nabi, 35, called it the price of progress. "Some people are unhappy because their fields are being destroyed, but if the government is going to help them, I think it's OK. We also want to have roads."
Afghans lining up at a NATO clinic praised the improved security.
"The Taliban were forcing us to give them food and water and a place to stay. We had no choice," said Sardam Mohammad, who brought his 4-year-old son for a checkup. "We're happy that the soldiers are here. If they leave we won't be safe."
He said the Taliban burned his children's school. "If they come back," he said, "we will stand up and fight."
Visit FOXNews.com's Afghanistan Center for complete coverage.