President Barack Obama announced that thousands of US troops will remain in Afghanistan past 2016, retreating from a major campaign pledge as he admitted Afghan forces are not ready to stand alone.
Calling his decision Thursday to keep a 9,800-strong US force in Afghanistan through much of next year "the right thing to do," Obama acknowledged "Afghan forces are still not as strong as they need to be."
"As commander in chief, I will not allow Afghanistan to be used as a safe haven for terrorists to attack our nation again," he said.
Coming to office in 2009, Obama had pledged to end the war in Iraq and the one in Afghanistan that has now cost more than 2,000 US lives and wounded and maimed tens of thousands.
More than six years on, thousands of troops remain in both countries.
Obama's repeated promises to end America's "longest war" have again been thwarted by a dogged Taliban insurgency and Afghan forces slow to be effective.
Addressing battle-weary troops who may now be forced to return for another tour of duty, Obama said they could "make a real difference" to stabilizing a strategic partner.
"I do not send you into harm's way lightly," he told them.
"I do not support the idea of endless war, and I have repeatedly argued against marching into open-ended military conflicts that do not serve our core security interests."
The war in Afghanistan was prompted by the Taliban refusal to surrender Al-Qaeda leaders including Osama bin Laden after the 9/11 terror attacks.
Obama's decision -- announced in a televised address from the Roosevelt Room of the White House -- means he bequeaths to his successor a 14-year war that he inherited from George W. Bush.
Under previous plans for Afghanistan, the United States would have reduced its troop numbers by the end of 2016 from about 10,000 currently, to about 1,000.
But now, by late next year or early 2017 when Obama steps down and the 45th US president is sworn in, their numbers are expected to remain at about 5,500.
- 'Jihad will continue' -
Recent intense fighting has underscored the continued role of US troops in training the still fledgling Afghan forces and in vital counterterror operations.
Just this week the NATO coalition said US and Afghan forces had carried out one of their largest joint operations in southern Kandahar province, dismantling a major Al-Qaeda sanctuary in the Taliban's historic heartland.
The Taliban responded to the US announcement saying they would keep fighting until American troops finally pull out.
"They were the ones who decided to invade Afghanistan. But it will be us who decide when they leave," said Taliban spokesman Zabiullah Mujahid.
"When the attacks continue to mount on the occupiers and when they see they have to spend more money in their meaningless war, they will be forced to change their oppressive policy. Our jihad will continue until the last occupier is expelled," he told AFP.
Two weeks ago the Taliban scored their biggest military victory since the 2001 US-led invasion, capturing the city of Kunduz.
Only a swift response by US-trained Afghan security forces led to an eventual Taliban retreat.
- Extensive review -
A senior administration official said Obama was making his announcement "as a result of an extensive, months-long review, and in consultation with his full national security team and our Afghan partners."
The 5,500 troops that will remain late next year or in early 2017 will stay at a small number of bases, including at Bagram Airfield -- the largest US military base in the country -- Jalalabad in the east, and Kandahar in the south.
But Obama stressed the troops would not have a combat role.
Instead they would carry out "two narrow but critical missions -- training Afghan forces, and supporting counterterrorism operations against the remnants of Al-Qaeda."
"While America's combat mission in Afghanistan may be over, our commitment to Afghanistan and its people endures."
The announcement follows a series of setbacks, including a US air strike on October 3 on a hospital in Kunduz run by Doctors Without Borders that killed at least 14 staff and 10 patients, with nine others still unaccounted for.
US Defense Secretary Ashton Carter said Thursday that he believes NATO allies will renew or adjust their contributions to the US-led coalition as Washington extends its mission.
"I've already initiated consultations with key allies to secure their continued support for this mission," he said.
NATO Secretary General Jens Stoltenberg welcomed the US decision as part of a "crucial" effort to support Kabul.
"This important decision paves the way for a sustained presence by NATO allies and partners in Afghanistan," he said.
In Berlin, meanwhile, Foreign Minister Frank-Walter Steinmeier promised that Germany "will also continue to commit" to the mission.
"We have argued before now that our commitment to training in Afghanistan should not be tied to a fixed calendar, but for decisions to be taken based on the situation on the ground.
"The US decision is a good basis for that."
Speaking at Indiana University, Secretary of State John Kerry said that keeping US forces in Afghanistan "is essential to give the new government of national unity the support that it needs to implement reforms and defend its population against violent extremists."
And it's important to "understand what happens" when you have ungoverned areas "and the vacuum is filled by extremists."