Afghan security police stand guard at checkpoint in Afghanistan’s Helmand province in this Feb. 26 file photo. President Obama appears determined to end the U.S. mission in Afghanistan by 2017. (Abdul Khaliq/AP)

Top U.S. officials have shown a willingness to adjust President Obama’s plan for winding down the war in Afghanistan, allowing military commanders to delay troop departures and expanding combat authorities for forces remaining on the ground.

But there’s one thing they’ve made clear is not up for discussion: Obama will end the U.S. military mission entirely by the time he leaves office in January 2017.

Obama is expected to announce this week that he will keep as many as 5,000 more U.S. troops in Afghanistan over the next year than originally planned. The overall goal, though, hasn’t changed. The president is determined to leave office with fewer than 1,000 U.S. personnel in Afghanistan, based at an office of security cooperation in Kabul.

“As a strategic matter, it remains the intent to continue the retrograde,” said Jeff Eggers, a senior adviser to the president on Afghanistan and Pakistan. “That’s the process that will continue.”

The president’s desire to end the longest war in American history says more about how he views his legacy than about conditions on the ground in Afghanistan, which have continued to deteriorate with the diminished American footprint.

Afghan President Ashraf Ghani, who will be in Washington beginning Monday, has asked the president to delay the departure of the approximately 10,000 troops based in the country. The request is an acknowledgment of the increase in deaths among Afghan civilians and security forces in the past year.

“The president is pretty clear that he would like to end the war in Afghanistan,” said Richard Fontaine, president of the Center for a New American Security, a nonpartisan think tank. “The question is whether the war in Afghanistan is going to let him end it.”

For weeks, Obama’s top aides have been considering a military request to eliminate a year-end deadline for bringing the number of U.S. troops in Afghanistan to 5,500. The move would give Army Gen. John F. Campbell, the American commander there, more time to train Afghan forces, an effort disrupted by last year’s disputed Afghan elections. “The political crisis resulted in non-trivial delays to the advisory program,” Eggers said.

The delays would allow the United States to keep open through next year two key regional bases in the east and south — where some of the heaviest fighting and casualties have occurred in recent years. “Without those bases, you lose your eyes and ears in the most contested areas of the country,” said retired Army Lt. Gen David Barno, a former top commander in Afghanistan.

U.S. attack planes and helicopters flying from bases in Kandahar and Jalalabad have provided critical firepower to help Afghan army and police forces withstand large-scale Taliban attacks. “That’s a big hammer in our toolbox,” Barno said.

It would not be the first time the White House has deviated from the plan Obama announced in May 2014 for bringing the war “to a responsible end.” In December, facing a shortfall in NATO troop contributions, officials announced they would delay a deadline for reducing the U.S. force to 9,800. Last fall, Obama expanded some authorities for U.S. troops after the end of the NATO combat mission.

Today, the Afghanistan war, despite increasing levels of violence, is largely invisible to the U.S. public. American casualties have plummeted in recent months as U.S. trainers have largely retreated to fortified bases. Only highly trained American counterterrorism forces venture out with any regularity.

The volatile and contentious relationship that Obama had with the country’s former president, Hamid Karzai, who frequently blamed the United States for the growing violence, has given way to a quiet partnership with Ghani, his successor. “This is a different relationship,” said Eggers. “It is clearly cooperative and better.”

Obama probably wouldn’t pay a price politically for keeping the current level of U.S. troops in the country through the remainder of his presidency. His imperative to withdraw from Afghanistan seems to be a personal one.

“There’s a moral responsibility for removing Americans from harm’s way, and there’s also just the recognition that you have to define an end at some point,” said a senior White House official who spoke on the condition of anonymity because he was not authorized to discuss the matter on the record. “In places like Afghanistan, Yemen, Somalia, Iraq, there’s not going to be an end where everything is stable and secure and there’s no violence and bad guys.”

The 2017 deadline raises the pressure on Ghani, who has backing from the West to combat corruption, improve ties with Pakistan and lay the groundwork for peace talks with the Taliban.

Ghani, though, faces massive challenges in holding an unsteady unity government together and in containing the ripple effects of the country’s faltering economy, which depends heavily on U.S. financial aid.

The Taliban, meanwhile, remains a potent foe. Although Afghan forces conduct operations against insurgents on their own, they lack high-tech intelligence tools and air power. They struggle to supply troops with weapons and keep military vehicles running. As the Taliban continued its attacks into the winter months, civilian casualties jumped 22 percent in 2014, while U.S. officials have described deaths among Afghan security forces as “unsustainable.”

Some Republicans, long opposed to any withdrawal timeline, are pushing Obama to revisit his plan to bring the troop level to zero by 2017.

Sticking to the 2017 deadline “would invite the same disaster we have seen in Iraq: a vacuum filled by instability and terror that would ultimately threaten the United States,” Republican Sens. John McCain (Ariz.) and Lindsey O. Graham (S.C.) said in a joint statement last week. “History will judge President Obama’s legacy not by the day we leave Afghanistan, but by what we leave behind.”

Others also point to the lessons of Iraq.

“If we pull out too quickly, there is a real risk Afghanistan will become insecure and will become a safe haven for transnational terrorist groups,” said Andrew Wilder, a scholar at the U.S. Institute of Peace and a longtime Afghanistan expert.

Barno, the former Afghanistan commander, gave an even more dire prediction. “Within six months of [the withdrawal], it could be game over for the Afghans, especially if the American money doesn’t stay there, too.”