On Monday night, their shift at Bagram was scheduled to begin at 10 p.m., and at 9:45 they reached the village of Shahka, less than two miles from the base, where a Taliban ambush was waiting for them, the Afghan police said.