Lt. Col. Noor Agha, the third of the three men fighting ISIS here, is a district police chief who cuts a soft-spoken, fatherly figure. He has been in charge of the last line of defense against ISIS: This far into Taliban country, there were no Afghan commandos or American special forces to help out.

Colonel Agha has only about 170 regular police officers under his command, 30 of them not present for duty, and about as many militiamen, such as the ones Mr. Makee commands.

As residents started fleeing last month from the fighting between the Islamic State and the Taliban, it suddenly appeared that the government could lose even its nominal control if ISIS fighters reached a strategic hill.

Colonel Agha carved a road from the district center to the top of the hill, a path made for the first time, 16 years into the war. He cobbled together about 50 men, 20 of them from the army, and they made their way through the poppy fields to establish outposts on the hill.

Many of the men on the hill slept under the open sky. They lacked heavy weaponry. As they looked down, it was Taliban to the right, Taliban to the left, Taliban at the foot of the hill. In the distance was the Islamic State, its fighters heavily armed with machine guns and rocket launchers, Col. Agha says. He knows that because his troops have been fired upon and taunted over the radio as infidels and American militias.

Letting down his pride for a moment, the colonel admitted they couldn’t fire back.

“What can we hit them back with?”

In the end, Colonel Agha’s fighters were saved from having to find out by additional Afghan Army units, who arrived to help clear ISIS from Khogyani. Local commanders in recent days say they have killed at least 50, and the rest have started shifting their base of operations — again.