The U.S. isn’t quite at war in Afghanistan but isn’t exactly at peace either.

On the ground, U.S. special-operations troops accompany Afghan counterparts once or twice a day on raids to kill or capture insurgent leaders. But they don’t enter target buildings or go after the insurgents themselves.

From the air, U.S. helicopters and planes routinely bomb or strafe enemy positions, and come to the rescue of beleaguered U.S. and Afghan troops. But those attacks occur about 70% less often than they did a year ago, the Air Force says, and require top-level approval.

“We could go and do the mission” for the Afghans, said Command Sgt. Maj. James Napolet, the senior enlisted man among American special-operations troops here. “But our intent is for them to be a fully capable force that can do the mission on their own.”

That said, he added, “we assist them where they need the assistance.”

For more than a year, the military has maintained a veil of secrecy over its special-operations forces in Afghanistan. For two weeks this summer, however, the military permitted The Wall Street Journal to visit a variety of commando units, offering a glimpse into what may be the last fighting season of America’s longest war.

What emerges is a picture of a military in a netherworld, trying to find a middle ground between doing too much and too little as its role winds down.

Special-operations forces now conduct the bulk of U.S. missions in Afghanistan, where their main responsibility is making sure their elite Afghan counterparts can fight on their own before American troops leave, a full withdrawal that President Barack Obama has announced will take place by the end of next year.

The special-operations mission has taken on more urgency against the backdrop of events in Iraq, where the U.S. withdrew at the end of 2011 only to watch American-trained forces collapse before the onslaught of Islamic State, or ISIS, a militant force that has begun to appear in Afghanistan as well.

In Afghanistan, “we’re always there as a backstop to strategic failure,” said a senior U.S. special-operations officer.

Click for more from The Wall Street Journal.