President Obama announced Wednesday that he will keep roughly 3,000 more U.S. troops in Afghanistan than previously announced – prolonging America’s role in a war that already has lasted more than a decade.

Obama said he will leave around 8,400 U.S. troops in Afghanistan when he leaves office in January.

“The Taliban remains a threat,” Obama said from the Roosevelt Room with Defense Secretary Ash Carter and the Joint Chiefs of Staff chairman, Gen. Joseph Dunford.

Obama had planned to drop troop levels to 5,500 troops, from 9,800, by the end of 2016. But Taliban resurgence has forced a reconsideration of his administration’s exit strategy.

Obama said he made the decision after receiving recommendations from top military leaders who urged him to revise his earlier plan. He said boosting the planned troops levels would help U.S. allies prepare their own contribution to the fight in Afghanistan and would help the next president make good decisions about the future of U.S. involvement in the country where America has been fighting since 2001.

“The decision I’m making today ensures that my successor has a solid foundation for progress in Afghanistan, as well as the flexibility to address the threat of terrorism as it evolves,” Obama said.

He added, “l firmly believe the decision I’m announcing is the right thing to do.”

Obama said the U.S. mission would remain narrowly focused on “training and advising” Afghan forces and supporting counterterrorism operations against the remnants of al-Qaida, the group that attacked the U.S. on Sept. 11.