President Obama promised during his 2012 reelection campaign that he would end the war in Afghanistan by 2014 and then said in meeting after meeting this spring and summer that he would bring the last American troops home by the end of his tenure. But on Thursday, Obama announced that he will reverse course and leave 9,800 American troops in Afghanistan through late 2016 or early 2017, when the U.S. force fighting in America's longest-running war will be reduced to about 5,500 troops for the foreseeable future.

"As commander in chief, I will not allow Afghanistan to be used as a safe haven for terrorists to attack our nation again," Obama said in his announcement in the White House alongside Vide President Joe Biden, Defense Secretary Ash Carter and Chairman of the Joint Chiefs of Staff Joseph Dunford, reported ABC News. "Afghan forces are still not as strong as they need to be."

Obama said he is convinced that his decision offers "the best possibility for lasting" peace in Afghanistan, reported The Guardian. "In key areas of the country the security situation is still very fragile and there is still risk of deterioration."

Some of the troops will continue training and advising Afghan forces, while others will hunt for al-Qaida and Islamic State group fighters, according to The New York Times. The troops will be stationed in Kabul, Jalalabad, Kandahar and Bagram.

"The important thing I want to re-emphasize though is that the nature of the mission has not changed," Obama said. "This modest but meaningful extension of our presence, while sticking to our current narrow missions, can make a real difference. It's the right thing to do."

He insisted that he "does not support the idea of endless war...yet given what's at stake in Afghanistan...I'm firmly convinced that we should make this effort."

Taliban insurgents have reportedly taken over more of the country than at any point since the war began in 2001, according to the United Nations. Last month, the group won its biggest victory of the war by seizing the north city of Kunduz and holding it for more than two weeks before backing down, according to the Times.

Republican presidential candidate Jeb Bush, a former Florida govenor, said he is glad to hear that Obama dropped his plan to "abandon the region entirely" but added, "If he is truly committed to fighting terrorism and securing a stable Afghanistan, he shouldn't short change what our military commanders have said they need to complete the mission."

Sen. John McCain, chairman of the Senate Armed Services Committee, agreed, saying he is "concerned that the number of troops will not be sufficient to perform the critical tasks being set for them: counterterrorism and continuing to train and advise our Afghan partners. It is highly unlikely that a force level of 5,500 troops was recommended as the best professional judgment of our senior military leaders and commanders on the ground in Afghanistan."