President Donald Trump has said a hasty US withdrawal from Afghanistan would leave a vacuum for terrorists to fill.
He said his original instinct was to pull US forces out, but had instead decided to stay and "fight to win" to avoid the mistakes made in Iraq.
He said he wanted to shift from a time-based approach in Afghanistan to one based on conditions on the ground, adding he would not set deadlines.
However, the US president warned it was not a "blank cheque" for Afghanistan.
"America will work with the Afghan government, so long as we see commitment and progress," he said.
The Taliban responded by saying that Afghanistan would become "another graveyard" for the US if it did not withdraw its troops.
What is the new strategy?
President Trump has committed to stepping up the US military's engagement in Afghanistan, but details were few and far between.
He said his new approach would be more pragmatic than idealistic, and would switch from nation building to "killing terrorists".
But he refused to get drawn on how many extra troops, if any, would be deployed and gave no timeline for ending the US presence in the country.
Washington is expected to send up to 4,000 additional troops, but Mr Trump did not comment on this.
The president did, however, put pressure on neighbouring Pakistan, warning that the US would no longer tolerate it offering "safe havens" to extremists - an accusation swiftly dismissed by a Pakistani army spokesman.
The president also, for the first time, left the door open for an eventual peace deal with the Taliban, saying: "Someday, after an effective military effort, perhaps it will be possible to have a political settlement that includes elements of the Taliban in Afghanistan."
However, Mr Trump said there would be an escalation in the battle against groups like al-Qaeda and so-called Islamic State.
"[They] need to know they have nowhere to hide - that no place is beyond the reach of American arms," he said.
Meanwhile, Mr Trump made it clear he expects his existing allies - singling out India - to support him in his new strategy, and urged them to raise their countries' contributions "in line with our own".
Read more on Trump's presidency:
The key is in Islamabad, not Kabul
By Secunder Kermani, BBC correspondent in Kabul
Even with a few thousand extra US soldiers in Afghanistan - deployment levels would remain far lower than their peak in 2010/11 when there were around 100,000 US personnel in the country. So what is different this time?
Firstly, that there is no deadline by which the US will begin to scale operations back. Critics of President Obama's surge say that because he made it clear it was temporary - the Taliban were encouraged to wait the Americans out.
The second difference is that the US will put more pressure on Pakistan to end "safe havens" for the Taliban, according to President Trump.
One analyst told me that the key to solving the conflict lies in Islamabad not in Afghanistan. But it is not clear how much leverage the US still has over Pakistan - or how Pakistan will respond to the accusations, given its consistent denial that it operates a "good terrorist, bad terrorist" policy.
Pakistan has grown increasingly close to China, and has already had millions of dollars of US aid withheld for allegedly not taking enough action against the Taliban-allied Haqqani network.
Is Trump flip-flopping?
Before his presidency, Mr Trump was not shy about criticising his predecessors on their Afghanistan policy. He previously supported pulling US troops out of the conflict, which began under President George W Bush in 2001 after the 9/11 attacks.
We have wasted an enormous amount of blood and treasure in Afghanistan. Their government has zero appreciation. Let's get out!— Donald J. Trump (@realDonaldTrump) November 21, 2013
Early on in his presidential campaign, however, he did acknowledge that US troops would have to stay in order to avoid the total collapse of the Afghan government.
And this long-awaited announcement came after a months-long review, with the president himself acknowledging that his original instinct to pull-out had been reversed after discussions with national security advisers.
BBC correspondent Aleem Maqbool in Washington says the people who might object to Mr Trump's strategy are the very ones who voted for him.
They were told the president would focus on a policy of "America First", but he now says he wants a win in Afghanistan to make all the sacrifice worthwhile, our correspondent adds.
What is the reaction?
Afghan President Ashraf Ghani welcomed the plan, saying: "The US-Afghan partnership is stronger than ever in overcoming the threat of terrorism that threaten us all."
He said the new strategy would enhance the training of Afghan security forces.
Nato chief Jens Stoltenberg also praised the move and said the alliance, which has about 12,000 troops in Afghanistan, would not allow the country to become "a safe haven for terrorists who would attack our own countries".
General John Nicholson, the head of both US and international forces in Afghanistan, said it "means the Taliban cannot win militarily".
But Taliban spokesman Zabiullah Mujahid dismissed Mr Trump's strategy as "nothing new", telling the US to think of an exit strategy "instead of continuing the war".
US combat operations against the Taliban officially ended in 2014, more than 8,000 special forces continue to provide support to Afghan troops.
The Afghan government continues to battle insurgency groups and controls just half of the country.