WASHINGTON — As commander of an armored cavalry troop, H. R. McMaster fought in the largest tank battle of the Persian Gulf war, earning a Silver Star in the process. Afterward, the young captain reflected on how different his experience had been from the accounts he had read about Vietnam.

So when he arrived at the University of North Carolina for graduate studies in fall 1992, questions swirled through his head: How had Vietnam become an American war? Why did American troops die without a clear idea of their mission? “I began to seek answers to those questions,” he later wrote.

The result was a dissertation that turned into a book that would become, for a whole generation of military officers, a must-read autopsy of a war gone wrong. Now, as a three-star general and President Trump’s national security adviser, General McMaster will have the opportunity to put the lessons of that book to the test inside the White House as he serves a mercurial commander in chief with neither political nor military experience.

The book, “Dereliction of Duty,” published in 1997, highlighted the consequences of the military not giving candid advice to a president. General McMaster concluded that during Vietnam, officers on the Joint Chiefs of Staff “failed to confront the president with their objections” to a strategy they thought would fail. Twenty years later, the book serves as a guidepost to how he views his role as the coordinator of the president’s foreign policy team.