Kabul welcomed the US decision to keep thousands of troops in Afghanistan past 2016, vowing to respond to a resurgent Taliban "with full force" even as the rebels promised to wage jihad until the last American soldier leaves.
President Barack Obama's decision Thursday to keep a 9,800-strong US force in Afghanistan through much of next year came as he admitted that Afghan forces were not ready to stand alone.
Calling the plan "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 in a televised address.
Afghanistan welcomed the decision, saying in a statement late Thursday it "will respond to fear and terror with full force", but adding that it will keep "ajar the door to peace".
President Ashraf Ghani also tweeted his support for the decision.
"Beside stability/development of AFG, we remain determined to strengthen the relations in the area of fighting terrorism now more than ever," he wrote.
Recent intense fighting has underscored the continued role of US troops in training the still fledgling Afghan forces and in vital counterterror operations.
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 Afghan security forces, backed by US and NATO troops, led to an eventual Taliban retreat.
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 Thursday.
Coming to office in 2009, Obama had pledged to end the wars in Iraq and Afghanistan, but more than six years on, thousands of troops remain in both countries.
The Afghan war in particular has cost more than 2,000 US lives and wounded and maimed tens of thousands.
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 stabilising a strategic partner.
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, made after what one official described as an "extensive, months-long review", 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, their numbers are expected to remain at about 5,500.
The 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, and would instead maintain their focus on training and counterterrorism.
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 24.
US Defense Secretary Ashton Carter said following the announcement that he believed NATO allies will renew or adjust their contributions to the US-led coalition.
NATO Secretary General Jens Stoltenberg welcomed the US decision as part of a "crucial" effort to support Kabul, while German Foreign Minister Frank-Walter Steinmeier promised that Germany "will also continue to commit" to the mission.