United States President Barack Obama has announced that he plans to leave 8,400 American troops in Afghanistan when he finishes his term - an increase from his previous plan, reflecting the difficulty of drawing down the US presence in the war in the country.

"Maintaining our forces at this specific level ... will allow us to continue to provide tailored support to help Afghan forces continue to improve," Obama said on Wednesday from the White House.

"I will not allow Afghanistan to be used as safe haven for terrorists to attack our nation again."

Obama had planned to drop troop levels down from 9,800 to 5,500 troops by the end of 2016. But a Taliban resurgence has forced Washington to rethink its exit strategy.

What does a US drawdown mean for Afghanistan?

"I strongly believe that it is in our national security interest, especially after all the blood and treasure we have invested in Afghanistan over the years, that we give our Afghan partners the very best opportunity to succeed," said Obama, speaking next to Ash Carter, the US defence chief, and General Joseph Dunford, the top US military commander.

Obama said "the narrow missions" assigned to US forces will not change, and that they will remain focused on "training" Afghan forces and "supporting" operations against al-Qaeda and other armed groups, including the Islamic State of Iraq and the Levant (ISIL, also known as ISIS).

In response to Obama's announcement, Taliban spokesperson Zabihullah Mujahid told Al Jazeera: "Whether the US decides to keep [its] troops in Afghanistan or not, whether the numbers are more or less, we will continue to fight them."

"Nothing changes for us and nothing can scare us or stop us in achieving what we have been fighting for the past decade. We are stronger than ever and 8,400 troops cannot stop us. So its basically useless for them to make such decisions, a waste of time."

When Obama first ran for office, he had campaigned for a complete withdrawal of troops from Afghanistan, as well as in Iraq.

At the height of the US combat mission, there were an estimated 100,000 troops in Afghanistan.

Appeal to Taliban

Obama heads to Poland on Thursday to attend a NATO summit, where he is expected to lay out his plan on Friday in Warsaw for Afghanistan and the rest of the region.

Al Jazeera's Patty Culhane, reporting from Washington, said the number of troops Obama announced was based on recommendations from military commanders in Afghanistan.

"Now he is leaving more troops than he had hoped," Culhane said. "He said simply that the Afghan forces are not strong enough."

The numbers reflect a compromise between Obama's original plan and what many military commanders had recommended.

Last month a group of more than a dozen former US ambassadors and former commanders of US forces in Afghanistan wrote to Obama urging him to keep the current level of US troops through the remainder of his term in office.

Armed Taliban fighters have stepped up their nearly 15-year war since NATO pulled most of its forces out of the country at the end of 2014, while a nascent peace process has stalled in Afghanistan, which saw civilian casualties soar past 11,000 last year.

For the first quarter of this year, as many as 600 civilians were killed and 1,343 were injured, according to a United Nations report in April, with the Taliban responsible for six out of every 10 casualties.

The Taliban, who were forced from power by a US-led invasion in late 2001, have been repeatedly blamed by the UN for deliberately targeting civilians in the war-torn country.

In his address on Wednesday, Obama urged the Afghan government and the Taliban to reach a "lasting political settlement" to end the conflict.

He will aso meet Afghan President Ashraf Ghani and Chief Executive Abdullah Abdullah at the NATO Warsaw summit, and said he expects more allies to step up to provide commitments of troops and funds through the end of the decade.