It was his last night of what his men were already calling a cursed deployment in Afghanistan.

Cmdr. Job W. Price had signed off on the final report on the ambush killing of an enlisted Navy SEAL team member. His staff had completed a plan to turn over American military outposts to their Afghan partners, and Commander Price had given an unusually emotional thanks to his team for its service.

His executive officer noticed that the commander’s Sig Sauer pistol was out on his desk that night, Dec. 21, 2012, where he had never seen it before. By the time Commander Price went back to his room, the photograph of his 9-year-old daughter was gone from his desk. In his trouser pocket was a report on the recent death of an Afghan girl in an explosion near an American base.

When Commander Price, the 42-year-old leader of SEAL Team 4, did not appear for a meeting the next morning with an Afghan general, his men searched in the mess hall, in the showers and finally along the row of berths called the Green Mile. In his room, they found him lying in his sleeping bag, the pistol in his hand, a pool of blood beneath the bed.

His death was shocking: Suicide was rare among SEALs, unusual during a deployment in a war zone and unprecedented for a high-achieving SEAL officer. He became the last SEAL to die in Afghanistan.

Everything had seemed to go wrong in Commander Price’s final deployment, which began in September. In short order, he lost four men — two SEAL team members, two Army soldiers — under his command. Relations with the United States military’s Afghan partners were tainted by distrust, and the Taliban were growing dominant in the remote region of southeastern Afghanistan where Commander Price’s forces were operating. By then, America’s hopes of defeating the Taliban were fading, and the military’s ambitions were focused on extricating its troops from daily combat.