Mr. Nasr, now dean of the Johns Hopkins School of Advanced International Studies, said the White House should leave behind a “credible force” to prevent the Taliban from replicating the advances of the Sunni militant group, the Islamic State in Iraq and Syria, and to give breathing space to Afghanistan’s fragile political process.

Such a force, he said, would be larger than the dwindling presence planned by the administration — 9,800 troops in 2015, half that in 2016 and a vestigial force thereafter — but far smaller than the 101,000 troops that were in Afghanistan at the peak of American involvement in 2011.

These arguments have registered in a White House confronting a cascade of crises. While there have been no formal deliberations over Afghanistan since the start of the airstrikes in Iraq, this official said, Mr. Obama has discussed the parallels with his senior aides.

The absence of political accommodation in both countries, the president told them, sharply limits the United States’ ability to help. In Afghanistan, even the presence of nearly 29,000 American soldiers has done little to guide the country past its political crisis.

Mr. Obama, his advisers note, did not pick the “zero option” in Afghanistan, which would have meant withdrawing all troops at the end of this year. The United States will marshal the support of NATO allies to train and equip Afghan security forces. And the president’s personal engagement in the issue since the June election is proof, they say, that the United States is not going to stand by as Afghanistan unravels.

“There’s a middle ground between intervention and total disengagement,” the official said.

But Mr. Obama also made clear, when he announced the timetable for drawing down troops last May, that Afghanistan should not rely on the United States to manage the creation of a more stable society. That was up to its own security forces and elected officials, he said.

“We have to recognize that Afghanistan will not be a perfect place, and it is not America’s responsibility to make it one,” the president said, using language he has applied, almost word for word, to Iraq. “The future of Afghanistan must be decided by Afghans.”