Washington (CNN) President Barack Obama announced Thursday that U.S. forces will remain in Afghanistan at their current levels throughout much of 2016, yet another delay in their scheduled withdrawal and an acknowledgment that America's longest war won't be concluded on his watch.

Obama campaigned as the president who would end two wars, and Thursday's decision was a major political reversal that jeopardizes a cornerstone of his legacy. Taliban gains in Afghanistan and appeals from Kabul for ongoing U.S. assistance contributed to postponing the troop withdrawal and underscored Obama's continuing difficulty in fulfilling his intention to remove all American forces by the time he leaves office.

On Thursday, however, he told reporters at the White House that he wasn't disappointed at having to make the announcement that plans for the withdrawal had been put on hold. Instead, he said, his job was to make necessary adjustments given events on the ground.

He also stressed that the formal combat mission there has ended, and that he is a president who does "not support the idea of endless war." He ended the Iraq war and removed American troops there in 2011.

The plan announced Thursday keeps 9,800 U.S. troops in Afghanistan before an anticipated drawdown to around 5,500 by the time Obama leaves office. The troop's mission will remain the same, Obama emphasized -- to train and support Afghan security forces and carry out counterterrorism operations.

Obama began his announcement by highlighting U.S. gains in Afghanistan and noted that the Afghan government and its security forces are now "fully responsible for securing their country." But he also said that the U.S. still needs to bolster those forces to maintain the progress achieved and because "it's the right thing to do."

Photos: Doctors Without Borders hospital attacked in Afghanistan Photos: Doctors Without Borders hospital attacked in Afghanistan Flames are visible inside a Doctors Without Borders hospital in Kunduz, Afghanistan, after a U.S. airstrike on Saturday, October 3. At least 30 people died in the attack, the charity said in its internal review of the strike released Thursday, November 5. The commander of U.S. forces in Afghanistan has said the hospital was hit accidentally. Hide Caption 1 of 5 Photos: Doctors Without Borders hospital attacked in Afghanistan Doctors Without Borders said it had emailed the GPS coordinates of its main hospital and administration office building at the Kunduz center before the airstrike. The U.S. commander said airstrikes were called after Afghan troops advised they were "taking fire from enemy positions."

Hide Caption 2 of 5 Photos: Doctors Without Borders hospital attacked in Afghanistan Doctors Without Borders is asking for an indepedent investigation by the International Humanitarian Fact-Finding Commission. President Barack Obama has apologized to the charity group for the attack. Hide Caption 3 of 5 Photos: Doctors Without Borders hospital attacked in Afghanistan The attacks came as fighting intensified between Afghan government forces -- supported by U.S. air power and military advisers -- and the Taliban, which invaded Kunduz in late September. Hide Caption 4 of 5 Photos: Doctors Without Borders hospital attacked in Afghanistan "We were running a hospital treating patients, including wounded combatants from both sides -- this was not a 'Taliban base,' " said Dr. Joanne Liu, international president of Doctors Without Borders or Médecins Sans Frontières, upon release of the group's internal review of the attack. Hide Caption 5 of 5

"While America's combat mission in Afghanistan may be over, our commitment to Afghanistan and and its people endures," Obama said from the Roosevelt Room. "As commander in chief, I will not allow Afghanistan to be used as a safe haven for terrorists to attack our nation again."

Obama stressed that the decision to maintain 9,800 troops in Afghanistan until late 2016 came after months of discussions with Afghanistan's president, Ashraf Ghani, and the nation's chief executive officer, Abdullah Abdullah -- a nod to the fact that the U.S. is maintaining a presence in the country with the support of its leaders, unlike in Iraq, where the Obama administration could not reach an agreement with the Iraqi government on leaving a residual military force.

Ghani released a statement on Thursday afternoon welcoming Obama's announcement.

"The decision to maintain the current level of the United States' forces in Afghanistan once again shows renewal of the partnership and strengthening of relations of the United States with Afghanistan on the basis of common interests and risks," he said.

NATO also welcomed the move, saying in a statement that it "paves the way for a sustained presence" in Afghanistan for the organization and its allies.

Obama also noted that he had consulted with U.S. military commanders on the ground in Afghanistan as well as his entire national security team before deciding to maintain the current troop level.

White House Press Secretary Josh Earnest later told reporters that Obama chose to go with the Pentagon's greatest suggested number of troops.

"The highest recommendation that came into the President was the level that the President announced today," he said.

Defense Secretary Ashton Carter said in a news conference Thursday that while the fight in Afghanistan "remains a difficult fight," the adjusted force numbers will ensure that the U.S. can carry out its mission and help Afghans confront the continued challenge posed by the Taliban.

"Today's decision from the president to adjust our troop presence in Afghanistan honors that sacrifice (of U.S. troops) and gives us a chance to finish what we started," Carter said at the Pentagon.

The decision comes on the heels of recent Taliban gains in Afghanistan, notably the militant group's takeover of Kunduz, the first major city to fall to Taliban hands since 2001. Two weeks later, the Taliban pulled out of the city -- but the incident sent ripples through Afghanistan and shook Washington.

Obama noted as much when he said that while Afghan forces are "taking the lead" and fighting "bravely and tenaciously," those forces "are still not as strong as they need to be."

The U.S. plan is to now maintain 5,500 U.S. military personnel in Afghanistan after a drawdown set to take place in late 2016 or early 2017, more than five times the number of troops previously set to remain in the country at the start of 2017. Only about 1,000 troops had previously been set to remain in Afghanistan at the U.S. Embassy in Kabul.

Obama said the 5,500 troops post-drawdown would be based at the U.S. embassy and at military bases in Baghram, Jalalabad and Kandahar.

Carter said the Pentagon viewed that figure as "enough" to sustain the U.S. mission and accomplish the two-pronged goal of assisting the Afghan security forces and carrying out counterterror missions.

Though the decision clearly was a break from the game plan he had laid out and pitched to the American public, on Thursday he downplayed any suggestion that the delay in the withdrawal was a major setback.

Obama said the decision was not "disappointing" and said his mission has consistently been to "assess the situation on the ground" and make adjustments as necessary.

"This is not the first time those adjustments have been made," Obama said. "This won't probably be the last."

While Obama highlighted the sacrifices of the Afghan people and American forces who have circulated in and out of the war-torn country for more than 14 years of U.S. operations, Obama stressed that casualties are down overall and that U.S. troops will not be heading back into combat.

"The nature of the mission has not changed and the cessation of our combat role has not changed," Obama said.

Still, speaking to the American service members who will need to deploy to Afghanistan, he said: "I do not send you into harm's way lightly."

This is the second draw-down delay announced by Obama this year. In March, Obama said he planned to reduce U.S. forces in Afghanistan 5,500 U.S. military personnel by the end of this year, and then to an "embassy-only" presence by the end of 2016.

"The timeline for a withdrawal down to a embassy center presence, a normalization of our presence in Afghanistan, remains the end of 2016," Obama said in a joint press conference with Ghani last March.

Administration officials stressed U.S. military personnel in Afghanistan would continue to serve under two missions -- to root out remnants of al Qaeda as well as train and equip Afghan security forces. U.S. forces could also conduct counterterrorism operations against elements of ISIS in Afghanistan, should the group present a threat to the U.S. homeland, senior administration officials added.

The original White House goal was to hand over the counterterrorism side of the U.S. mission to Afghan security forces this year.

"It's in our interest to build up the Afghan security forces," said a senior administration official.

The estimated annual cost of maintaining current U.S. force levels in Afghanistan is $14.6 billion, a separate senior administration official said.

Obama had previously vowed to conclude the U.S. commitment in Afghanistan before he leaving office.

"We will bring America's longest war to a responsible end," Obama said at a Rose Garden ceremony in May 2014.

Retired Lt. Col. Rick Francona, a CNN military analyst and former intelligence officer, said Obama's decision is simply "kicking this can down the road" for the next president. Obama will be out of office by the time troops are set to be drawn down again.

"This is this administration pushing this off to the next administration because the next time they have to make this decision, it will be a different president in the White House," Francona said.

Republicans who have been seeking higher U.S. troop commitments gave a lukewarm response to Obama's announcement Thursday.

"While this new plan avoids a disaster, it is certainly not a plan for success," House Armed Services Committee Chairman Mac Thornberry said in a statement. "Given the troubling conditions on the ground in Afghanistan and the other security problems in the region, keeping 9,800 troops there through at least 2016 is necessary to our security interests."