For Obama, leaving more than a small force to protect the embassy in Kabul beyond next year would mean abandoning his goal to bring home almost all U.S. troops before leaving office. But even though Obama has declared the American war in Afghanistan to be over, the Taliban's recent advances have convinced the Pentagon, many in Congress and much of the national security establishment in Washington that it is critical for U.S. troops to remain there.
The insurgents are now spread through more of Afghanistan than at any point since 2001, according to the United Nations, and last month they seized the city of Kunduz with only a few hundred fighters. At the same time, al-Qaida operatives are still finding havens in the mountains of Afghanistan, and the Islamic State has gained a toehold by recruiting disaffected Taliban, opening a treacherous new chapter in the war.
Those developments have led the White House to become increasingly convinced of the need to keep some kind of counterterrorism force in Afghanistan. Just how large a force — and whether U.S. troops should also continue training Afghan forces — remains a subject of debate inside and outside the administration, said the officials, who asked to remain anonymous to discuss decision making within the administration.
But at the very least, those pushing for an expanded mission after 2017 would like to see the United States and its NATO allies maintain at least two or three bases from which drones could be flown and Special Operations Forces could readily strike at militants. The Central Intelligence Agency also wants a larger presence to help protect its assets in Afghanistan.
For now, the option that is being most seriously considered is a proposal made this past summer by Gen. Martin Dempsey, then the chairman of the Joint Chiefs of Staff, to keep 3,000 to 5,000 troops for the counterterrorism mission.
The officials said that the Pentagon had also presented other options that range from just an embassy force of about 1,000, which mainly protects U.S. diplomats in Kabul, to maintaining the current force of roughly 9,800, which would also allow U.S. forces to continue training and advising the Afghans.
Asked last week about what the president was considering, Josh Earnest, the White House spokesman, said: "We've acknowledged that there is a policy decision to be made." He added that the president valued input from the military.
Still, Obama and some of his closest advisers remain skeptical of the military's ability to continue training and advising Afghan forces, other officials said. Building the Afghan army and police was the main imperative of U.S.-led coalition for much of the past five years, and it has cost the United States more than $65 billion since the war's outset. Yet even with roughly 17,000 NATO troops still on the ground — including the 9,800 Americans — the Taliban still managed last month to take Kunduz, seizing a city for the first time since 2001.
Afghan forces struggled to retake Kunduz, despite U.S. airstrikes clearing a path and American Special Operations forces at times joining the fight. The city appeared to be back in government hands on Tuesday for the first time in more than two weeks after the Taliban said they were pulling out in order to avoid, as they said in a statement, the "unnecessary waste of ammunition."
The battle for Kunduz also laid bare the risks posed by air power when, on Oct. 3, an American strike was called in by Afghan troops. The air attack hit a hospital run by Doctors Without Borders, killing 22 patients and medical staff — and no insurgents.
The president is determined to avoid a repeat of the strike on the hospital, for which he personally apologized, and wants any mission after next year to be as narrow as possible, officials said.
Beyond the military, though, a powerful cross-section of the U.S. foreign policy and national security establishment is also pushing for as broad a military commitment in Afghanistan as possible. The latest salvo is a paper to be released on Wednesday by the Atlantic Council, a think tank, which bluntly declares: "U.S. and NATO force levels and presence around the country, as well as intelligence assets, should be maintained at or close to present levels."
The main argument of the paper, which was written by James B. Cunningham, a former ambassador to Afghanistan, centers on the need to continue helping Afghan forces, and to give the next American administration as much flexibility as possible.
But the most striking element of the paper, which was provided to The New York Times ahead of its release, is the list of more than 20 former senior officials, Democrats and Republicans alike, who have signed on to it. The list includes Madeleine Albright, the former secretary of state who served under President Bill Clinton; Stephen Hadley, who was national security adviser to President George W. Bush; two former defense secretaries, Chuck Hagel and Leon Panetta (who also ran the Central Intelligence Agency); and four former U.S. ambassadors to Afghanistan. The paper's two sponsors are Sens. John McCain, R-Ariz., and Jack Reid, D-R.I.
After 14 years of war in Afghanistan, the list of U.S. officials who have worked with the Afghans is long. And many have in the past year stepped forward to urge Obama to keep American troops in Afghanistan; in March, when President Ashraf Ghani of Afghanistan was in Washington, a group of 23 former ambassadors and senior officials made their point in an open letter to the president.
"Those of us who worked with the Afghans over the last decade or more feel that we've established a relationship that is of some enduring value," said James Dobbins, the Obama administration's former special representative for Afghanistan and Pakistan and one of the signatories to the Atlantic Council paper.
He argued that Afghanistan may be the most democratic country in the Muslim world today, and that its government was unambiguously the most pro-American. But without American troops, he said, Afghanistan's future is grim.
"I can't promise you that retaining a commitment at the current level will ultimately yield a completely peaceful settled and stable Afghanistan," he said. But leaving behind too few troop was lead to "an Afghanistan in complete turmoil."
"You like Syria?" he said. "How would you like to have another one?"
Ghani, a Columbia University graduate who lived in Washington for 15 years, has also proved a useful selling point for those arguing to keep troops in Afghanistan. The Afghan leader has proved far more eager to cooperate with the United States than his predecessor, Hamid Karzai, and he works so closely with Gen. John F. Campbell, the top American commander in Afghanistan, that many Afghans now refer to the American officer as their country's defense minister.
Yet, as American critics of a continued military presence in Afghanistan readily point out, Ghani is not popular among Afghans. And the problems in his government — like corruption and incompetence — run so deep that fixing them will take years, possibly decades.
For some in Washington, that is simply too long of a commitment for the United States to make, especially when the results are far from certain.
"We need to have a conversation about how much we care about this place," said Douglas Ollivant, a senior fellow at The New America Foundation in Washington.
"Are we willing to spend — the numbers are fuzzy — but somewhere between $10 and $20 billion per year in perpetuity for the privilege of Afghanistan not totally collapsing," said Ollivant, who previously who worked in the National Security Council for Obama and Bush. "And we're not talking about it being Xanadu — we're talking about not collapsing."