WASHINGTON — A new president confronts an old war, one that bedeviled his predecessor. He is caught between seasoned military commanders, who tell him that the road to victory is to pour in more American troops, and skeptical political advisers, who argue that a major deployment is a futile exercise that will leave him politically vulnerable.

Barack Obama in 2009. But also Donald J. Trump in 2017.

As Mr. Trump faces his most consequential decision yet as commander in chief — whether to send thousands more troops to Afghanistan, where a truck bombing on Wednesday offered a brutal reminder that the 16-year-old war is far from over — his administration is divided along familiar fault lines.

The dispute pits two generals who had formative experiences in Afghanistan — Defense Secretary Jim Mattis and the national security adviser, Lt. Gen. H. R. McMaster — against political aides, led by the chief strategist, Stephen K. Bannon, who fear that sending in more troops would be a slippery slope toward nation-building.

“They are going to be faced with the same questions we were,” said David Axelrod, a former senior Obama adviser, who worried, during the 2009 debate, that the generals were boxing his boss in. “How and when does this end? Or is it an open-ended commitment of American lives and resources? What will the investment produce in the long run?”