Rep. Mike Pompeo speaks during his Senate confirmation hearing in Washington on Jan. 12. (Bill O'Leary/Bill O'Leary)

IT HAS been widely observed that President-elect Donald Trump’s national security nominees differed with his campaign positions during their confirmation hearings on a range of issues, from the threat of Russia and importance of NATO to the value of building a wall along the border with Mexico. To his credit, Mr. Trump seemed to approve of these departures, tweeting that “I want them to be themselves and express their own thoughts, not mine!” While it can be harmful for an administration to send conflicting messages to adversaries and allies, at this pre-inauguration stage, it is encouraging that the president-elect appears ready to hear the different policies outlined by appointees such as Defense Secretary nominee James N. Mattis and John F. Kelly, the prospective secretary of Homeland Security — particularly as they appear to be tugging the administration toward more rational and centrist positions.

Of these, none is more important than the stance on torture staked out by CIA Director-designate Mike Pompeo and Attorney General nominee Jeff Sessions. During the campaign Mr. Trump repeatedly promised to use tactics “worse than waterboarding” on terrorist suspects, even though Congress has outlawed all interrogation tactics outside the Army’s interrogation manual, which conforms with international anti-torture conventions. As we pointed out at the time, Mr. Trump could try to get around the law by seeking a secret Justice Department legal ruling that it infringed on the president’s constitutional authority and then ordering the CIA to use harsher methods.

It was therefore important then that when Mr. Pompeo was asked whether he would follow such an order, he responded “absolutely not,” adding that he had voted for the 2015 law banning waterboarding as a member of Congress. Similarly, Mr. Sessions said that the law “makes it absolutely improper and illegal to use waterboarding or any other form of torture,” both for the military and for the CIA. While he said he had opposed making an Army field manual the standard for all agencies, Mr. Sessions said, “it is a law, and it needs to be enforced, absolutely.”

Mr. Sessions and Mr. Pompeo were not the first to line up behind the torture ban. By Mr. Trump’s own account, Mr. Mattis made a strong pitch about the ineffectiveness of torture during one of their initial conversations. “I was very impressed by that answer,” Mr. Trump told the New York Times, though he added, “I’m not saying it changed my mind.”

Whether he has changed his view or not, Mr. Trump has ensured through his national security appointments that any move to reinstate torture techniques will be stiffly resisted inside his own Cabinet. The statements by the nominees suggested the heartening conclusion that, despite the continuing political debate about the use of waterboarding and other “enhanced” interrogation methods during the George W. Bush administration, the nation’s military and intelligence establishments have learned the lesson from the enormous harm that resulted. The use of torture violated international law, badly tarnished the United States’ international image, and gave dictators and terrorists around the world an excuse to employ the same methods, including on Americans. Meanwhile, an exhaustive 2014 report by the Senate Intelligence Committee found the harsh methods yielded no valuable information.

Mr. Trump did not live through those years as a commander, as Mr. Mattis did, and he has not had the exposure of Mr. Pompeo to the intelligence community. Having now appointed them to lead national security agencies, he will do well if he not only allows them to speak their minds, but also listens to them.