This company of Afghan army soldiers, just back from the war, wait to train under a hot sun, in Mazar-sharif, Afghanistan. (Pamela Constable/The Washington Post)

Maj. Kabir Hamidzai was sitting in a Humvee within Taliban firing range, relaying information between an army troop commander and an attack helicopter pilot overhead.

A column of Afghan soldiers was moving toward an insurgent position from one side of a hill; a squad of U.S. Special Operations forces was advancing from the other. Hamidzai’s role was to guide chopper pilots from both directions, protecting the troops and then striking the insurgents.

Last week, back at this base in northeastern Afghanistan where he trains future combat air controllers, the officer described the operation conducted days earlier in Baghlan province. “Both convoys came together, the pilots fired their rockets, and 50 of the enemy were killed,” he said with a satisfied nod.

It was a small victory in a war that is being fought on two fronts, sometimes pulling in two directions. One is the ongoing conflict between Taliban insurgents and Afghan forces, which have been abruptly weaned from 15 years of Western funding and combat support while facing a fierce, persistent enemy. 

Four new MD-530 Cayuse Warrior helicopters arrived at Hamid Karzai International Airport, Afghanistan, Aug. 25, 2016, via a C-17 Globemaster III. (Tech. Sgt. Christopher Holmes/438th Air Expeditionary Wing)

The other is an ambitious effort by U.S. military officials and several NATO partners to create an independent, professional Afghan defense force. This includes training military fighter pilots, establishing rest and training rotations for infantry troops, and making sure administrators can deliver fuel, uniforms and bullets when they are needed.

“We are trying to build a plane while flying it,” said Air Force Brig. Gen. David W. Hicks, senior commander for the U.S. Air Expeditionary Wing based in Kabul. His metaphor applies to almost every aspect of the U.S. mission to “train, advise and assist” Afghan forces since the withdrawal of most NATO combat forces in 2014.

In a literal sense, the planes have already been built. This year, the United States has shipped eight A-29 fighter aircraft and 23 MD-530 attack helicopters to Afghanistan, while scores of Afghan pilots have undergone intensive training in the United States and Europe. 

Since June, those in the first group of pilots have been deployed frequently to escort and defend Afghan troops, but their numbers seem impossibly small and their entry into the war extremely late, at a time when Taliban forces have launched aggressive new campaigns in scattered, strategic provinces.

By all accounts, the pilots are highly motivated, but they also have had to adjust from the top-down military culture of the Soviet Union, which built the Afghan defense forces in the 1980s, to the Western emphasis on making their own judgments in midair, including assessing whether civilians are too close to a target to fire their rockets or drop their bombs.

“It’s not worth killing one bad guy if it harms families or children,” said Mohammed, 25, an Afghan Air Force MD-530 pilot based in Kabul. “I know I am responsible for my decisions. I am the commander in the air.” U.S. military officials asked that such pilots not be identified by their last names for security reasons.

Afghan army recruits cast shadows as they line up for training. The army’s attrition rate is officially estimated at 15 to 20 percent a year, mostly from soldiers going home after their first contract ends. Some Afghans say it is much higher. (Pamela Constable/The Washington Post)

Decentralizing the military bureaucracy and teaching Afghan forces to survive without the Western largesse have been a constant challenge. Both setups encouraged dependence and fostered corruption, which is viewed by many as the single largest obstacle to effective Afghan military performance in the war. 

Military supplies often vanish and end up in markets. Fuel coming by truck from Pakistan passes through many hands and can easily be siphoned off. Local commanders exaggerate how many bullets they have used and sell the replacements. Humvees with broken axles sit for months without being repaired. Fighting units run out of supplies because they are not ordered in time.

American and NATO advisers say the only way to ensure accountability and efficiency is by instilling modern administrative methods. But this is slowed by low literacy rates among Afghan troops, including many officers, and by entrenched nepotistic practices that make it difficult to get rid of incompetent staff. 

“Limiting opportunities for corruption takes a lot of paperwork. We mostly teach people the basics: how to fill out forms, how to track things on computers, how to make sure they order enough supplies in advance,” said Lt. Col. Gwenda Nielen, a Dutch officer who works with Afghan troops at Camp Shaheen in Balkh province.

For the Afghan infantry troops who bear the brunt of the war, just getting enough food, rest and ammunition can be a challenge on long deployments. American advisers are trying to set up a system in which soldiers rotate regularly through periods of fighting, resting and training, but the plan is still in the early stages and the army has been stretched thin this summer battling Taliban offensives. 

Last year, Afghan casualties were the highest since the war began, with about 16,000 soldiers and police officers killed or wounded. But U.S. military officials said Afghan forces are doing better this year. In a briefing last week, Brig. Gen. Charles H. Cleveland, senior spokesman for the U.S. military mission, said that the Taliban had won “some tactical victories” but that “overall, Afghan forces are generally on track with their campaign plans.”

Unlike the respected air force, where more than 90 percent of service members reenlist, the attrition rate in the Afghan National Army is officially estimated at 15 to 20 percent a year, mostly from soldiers going home after their first contract ends; some Afghans say it is much higher. Officials must scramble to fill the gap with recruits, who have to be trained from scratch.

At Camp Shaheen last week, a company of soldiers just back from the front lines was lining up to drill under a hot sun. The men looked tired and bedraggled. One grizzled officer said that he had been fighting the Taliban for nine years but that his company had lost at least 25 men. “The Taliban hide in trees and places we can’t see them. We need more air support,” he pleaded.

In an adjacent field, a group of fresh recruits was lined up for inspection before heading out to train. Asked why they had joined the army, several said they wanted to serve their country but then added that their families needed the money. 

“I’m happy, but I haven’t been to the war yet,” said Sayed Shah, 20, a recruit from Sar-e Pol province, adding that his promised salary of $130 a month would be his family’s only income. “I will do my best to fight,” he said. Then in a burst of inspiration: “I want to stay until I become a general.”