WASHINGTON — In a German prison camp 71 years ago, Master Sgt. Roddie Edmonds stared down the barrel of his Nazi captor’s pistol and refused to say which of his fellow prisoners of war were Jewish.

“We are all Jews here,” said Sergeant Edmonds, the highest-ranking American noncommissioned officer at Ziegenhain stalag that day, instead ordering more than 1,000 of his fellow prisoners to stand together in front of their barracks. The Geneva Convention required prisoners to provide only their name, rank and serial number, not their religion, Sergeant Edmonds said, warning the German that if he shot them all, he would be tried for war crimes.

That act of defiance in January 1945 spared the lives of as many as 200 Jews, and, on Wednesday, President Obama echoed Sergeant Edmonds’s words of solidarity with the Jews as he recognized him posthumously as the first American service member to be named Righteous Among the Nations, an honor bestowed on non-Jews who risked their lives to save Jews during the Holocaust.

The event was the first time a sitting American president has spoken at the Israeli Embassy, and it was all the more notable because it came only months after Mr. Obama clashed openly with Prime Minister Benjamin Netanyahu of Israel over the Iran nuclear deal. On Wednesday, there was little sign of the rift.