It was just one brief exchange about Afghanistan with an aide late in 2009, but it suggests how President Obama’s thinking about what he once called “a war of necessity” began to radically change less than a year after he took up residency in the White House.

Not long before, after a highly contentious debate within a war cabinet that was riddled with leaks, Mr. Obama had reluctantly decided to order a surge of more than 30,000 troops. The aide told Mr. Obama that he believed military leaders had agreed to the tight schedule to begin withdrawing those troops just 18 months later only because they thought they could persuade an inexperienced president to grant more time if they demanded it.

“Well,” Mr. Obama responded that day, “I’m not going to give them more time.”

A year later, when the president and a half-dozen White House aides began to plan for the withdrawal, the generals were cut out entirely. There was no debate, and there were no leaks. And when Mr. Obama joins the leaders of other NATO nations in Chicago on Sunday and Monday, the full extent of how his thinking on Afghanistan has changed will be apparent. He will announce what he has already told the leaders in private: All combat operations led by American forces will cease in summer 2013, when the United States and other NATO forces move to a “support role” whether the Afghan military can secure the country or not.

Mr. Obama concluded in his first year that the Bush-era dream of remaking Afghanistan was a fantasy, and that the far greater threat to the United States was an unstable, nuclear-armed Pakistan. So he narrowed the goals in Afghanistan, and narrowed them again, until he could make the case that America had achieved limited objectives in a war that was, in any traditional sense, unwinnable.