Mr. Obama devoted so much time to the Afghan issue  nearly 11 hours on the day after Thanksgiving alone  that he joked, “I’ve got more deeply in the weeds than a president should, and now you guys need to solve this.” He invited competing voices to debate in front of him, while guarding his own thoughts. Even David Axelrod, arguably his closest adviser, did not know where Mr. Obama would come out until just before Thanksgiving.

With the result uncertain, the outsize personalities on his team vied for his favor, sometimes sharply disagreeing as they made their arguments. The White House suspected the military of leaking details of the review to put pressure on the president. The military and the State Department suspected the White House of leaking to undercut the case for more troops. The president erupted at the leaks with an anger advisers had rarely seen, but he did little to shut down the public clash within his own government.

“The president welcomed a full range of opinions and invited contrary points of view,” Secretary of State Hillary Rodham Clinton said in an interview last month. “And I thought it was a very healthy experience because people took him up on it. And one thing we didn’t want  to have a decision made and then have somebody say, ‘Oh, by the way.’ No, come forward now or forever hold your peace.”

The decision represents a complicated evolution in Mr. Obama’s thinking. He began the process clearly skeptical of Gen. Stanley A. McChrystal’s request for 40,000 more troops, but the more he learned about the consequences of failure, and the more he narrowed the mission, the more he gravitated toward a robust if temporary buildup, guided in particular by Defense Secretary Robert M. Gates.

Yet even now, he appears ambivalent about what some call “Obama’s war.” Just two weeks before General McChrystal warned of failure at the end of August, Mr. Obama described Afghanistan as a “war of necessity.” When he announced his new strategy last week, those words were nowhere to be found. Instead, while recommitting to the war on Al Qaeda, he made clear that the larger struggle for Afghanistan had to be balanced against the cost in blood and treasure and brought to an end.

Aides, though, said the arduous review gave Mr. Obama comfort that he had found the best course he could. “The process was exhaustive, but any time you get the president of the United States to devote 25 hours, anytime you get that kind of commitment, you know it was serious business,” said Gen. James L. Jones, the president’s national security adviser. “From the very first meeting, everyone started with set opinions. And no opinion was the same by the end of the process.”

Taking Control of a War

Mr. Obama ran for president supportive of the so-called good war in Afghanistan and vowing to send more troops, but he talked about it primarily as a way of attacking Republicans for diverting resources to Iraq, which he described as a war of choice. Only after taking office, as casualties mounted and the Taliban gained momentum, did Mr. Obama really begin to confront what to do.