As explosions echoed through the Afghan mountains, I knew that each blast that tore through the night was also tearing through the flesh of my friends. It was October 2013; we had been caught in an ambush, and though the Taliban in the area had been killed quickly, the explosives they left behind for us were still detonating.

My fellow Rangers and I had arrived by helicopter and surrounded a small building in an open field; I.E.D.s had been buried, then armed by the enemy once we were in the middle of them. Any movement from that point onward threatened all of us.

[For more stories about the experiences and costs of war, sign up for the weekly At War newsletter.]

I had just returned from chasing down one of the insurgents, who had tried to bait us into another deadly ambush in a nearby gully, where an explosive was triggered that almost killed me and my teammates. Instead, Jany, our military working dog, raced ahead of us toward the enemy and was killed, trading his life for ours. When I returned to my platoon from that secondary ambush site, they had already suffered multiple casualties, and the dead and wounded were scattered on the ground under the moonlight. Explosions spat fire and rock at us.

A medic’s gloved hands moved with trained precision from casualty to casualty. He dashed from one to the next with intense purpose; I think that if he could have poured his own life into the veins of the men lying on the ground, he would have.