As the desert air cooled and night fell, Staff Sgt. John Mariana looked down into the reassuring eyes of one of the most valuable comrades of his eight-month deployment to Afghanistan: Bronco, his military working dog.

Sgt. Mariana and Bronco were leading a U.S. patrol in June 2011, searching for roadside bombs. Bronco kept his head low, sniffing for buried explosives. Suddenly, ahead in the dark, Sgt. Mariana saw a man just 10 feet away, pointing an AK-47 at them. Sgt. Mariana shouted, and Bronco bolted toward the attacker,...