President Obama announced Thursday he will keep 5,500 U.S. troops in Afghanistan beyond 2016, in a stark reversal from earlier pledges to end the war on his watch -- though Republicans still questioned whether the residual force will be enough to support Afghan forces and U.S. allies.

The decision follows months of appeals from military leaders to extend the drawdown timeline. And it marks an acknowledgement that, despite claims Al Qaeda is on the run, militants continue to pose a serious threat to the country. 

Obama originally had planned to pull out all but a small, embassy-based U.S. military presence by the end of next year. But military leaders argued the Afghans needed additional assistance and support from the U.S. to beat back a resurgent Taliban and hold onto gains made over the last 14 years. 

Under the new plan, the administration will keep the current force of 9,800 troops in Afghanistan through most of next year, then draw down to 5,500 troops in 2017, at a pace still to be determined by commanders. 

"While America's combat mission in Afghanistan may be over, our commitment to Afghanistan and its people endures," Obama said at the White House, in announcing his decision. 

More On This...

The president stressed that he does "not support the idea of endless war," but said Afghan forces are "not as strong as they need to be" and the Taliban have "made gains," leading to a "very fragile" security situation in key areas of the country. 

He called the new plan the "best possibility for lasting progress in Afghanistan," while saying the U.S. mission "will not change" even after 2016. 

Concerns about Afghan security were reinforced when Taliban fighters took control of Kunduz late last month, prompting a protracted battle with Afghan forces on the ground, supported by U.S. airstrikes. During the fighting, a U.S. airstrike hit a hospital, killing 22 people, including 12 Doctors Without Borders staff and 10 patients. 

U.S. commanders have also expressed concern about Islamic State fighters moving into the country and gaining recruits from within the Taliban. And on another front, the U.S. military launched a major operation against two Al Qaeda camps in Kandahar earlier this month; one of the camps reportedly was almost 30 square miles. The operation included dozens of airstrikes. 

Republicans welcomed Obama's decision Thursday to keep more troops in the country to deal with these threats -- but questioned whether 5,500 troops would be enough. 

"I am pleased that President Obama has decided to keep U.S. troops in Afghanistan to perform the right missions beyond 2016, both in and outside of Kabul," Sen. John McCain, R-Ariz., chairman of the Senate Armed Services Committee, said in a statement. "However, I am 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. ... 

"The bottom line is that 5,500 troops will only be adequate to conduct either the counterterrorism or the train and advise mission, but not both. Our military commanders have said that both are critical to prevent Afghanistan from spiraling into chaos." 

Rep. Peter King, R-N.Y., told Fox News there was "no way" Afghan forces could have tackled the Taliban if all U.S. forces withdrew. "This was a disaster waiting to happen," he said. But he called the president's compromise plan a "containment" strategy and questioned whether the "small number" would be enough. 

"While this new plan avoids a disaster, it is certainly not a plan for success," Rep. Mac Thornberry, R-Texas, chairman of the House Armed Services Committee, said in a statement. He also criticized the president for threatening to veto defense legislation "that provides their pay, benefits, and the authorities they need to get the job done" -- in reference to an ongoing dispute over a defense authorization bill that would bust budget caps. 

U.S. officials have been hinting at the policy shift for weeks, noting that conditions on the ground in Afghanistan have changed since Obama's initial decision on a sharper troop withdrawal timeline was made more than two years ago. The White House has also been buoyed by having a more reliable partner in Afghan President Ashraf Ghani, who succeeded the mercurial Hamid Karzai last year. 

"The narrative that we're leaving Afghanistan is self-defeating," Defense Secretary Ash Carter said Wednesday during a speech at the Association of the U.S. Army. "We're not, we can't, and to do so would not be to take advantage of the success we've had to date." 

Asked Thursday if 5,500 troops is enough, Carter said, "We did a lot of homework on this." He maintained that the troop presence, along with continued financial assistance and training for the Afghan military, "are the ingredients to continue the prosecution of the mission." 

The troops staying in Afghanistan beyond next year will continue to focus on counterterrorism missions and training and advising Afghan security forces, officials said. They will be based in Kabul and Bagram Air Field, as well as bases in Jalalabad and Kandahar. 

The president's decision to keep the U.S. military in Afghanistan beyond his tenure thrusts the conflict into the 2016 presidential race. The next president will become the third U.S. commander in chief to oversee the war, with the options of trying to bring it to a close, maintaining the presence as Obama left it or even ramping up U.S. involvement in the conflict. 

Officials said discussions on staying in Afghanistan longer began during Ghani's visit to Washington in March. The top U.S. commander in Afghanistan, Gen. John Campbell, recently presented the president with a range of options calling for keeping more troops there. Officials said NATO allies had expressed support for extending the troop presence in Afghanistan, but they did not outline any specific commitments from other nations. 

Upending the troop withdrawal decision, however, carries broad political implications. 

Obama campaigned for the White House on a pledge to end America's involvement in the two wars he inherited, Iraq and Afghanistan. Now, he'll likely finish his presidency with troops back in both countries. 

The president did withdraw all U.S. troops from Iraq in late 2011, a moment he heralded as a promise kept to a war-weary nation. But the rise of the Islamic State drew the U.S. military back into Iraq last year to train and assist local security forces and launch airstrikes. 

Obama announced the end of the Afghan war with similar fanfare last spring, saying it was time for the U.S. to "turn the page" on more than a decade of deadly conflicts. 

In March, at a press conference with Ghani, he said, "The date for us to have completed our drawdown will not change." 

The Associated Press contributed to this report.