WASHINGTON — At the direction of the young dictator Kim Jong-un, officers in the North Korean military have carried out the executions of more than 340 of the country’s own citizens, including other military officials, using methods that are often as morbidly theatrical as they are inhumane and barbaric.

President Trump saluted one of those officers this week.

Mr. Trump’s salute — captured in a lengthy documentary on the Singapore summit meeting produced by North Korean state media — put the White House on the defensive Thursday and drew questions about whether a high-ranking officer of a militaristic dictatorship deserved to be on the receiving end of a gesture meant to symbolize respect, camaraderie and reverence.

“It’s a common courtesy when a military official from another government salutes that you return that,” Sarah Huckabee Sanders, the White House press secretary, said during a briefing with reporters.

In the documentary, the president was shown saluting the officer — Gen. No Kwang-chol, the North Korean defense chief — after first trying to shake the general’s hand. Mr. Kim is shown standing nearby.

According to military protocol, it is customary to salute officers of friendly foreign nations, though it is unclear whether the relationship between the two countries can best be categorized as a congenial one. Despite the photogenic warmth between Mr. Trump and Mr. Kim, the president has repeated his determination to continue imposing sanctions on the North until it abandons its nuclear weapons. And, Ms. Sanders said, the president addressed the North’s human rights record with Mr. Kim when they met.

But the practice of modern presidents returning salutes is thought to go back only as far as the 1980s, when President Ronald Reagan began exchanging salutes with troops. The practice has since been adopted by his successors, who occasionally land in hot water over their technique.

President…