NATO leaders agreed Saturday to continue training Afghan security forces through 2017 and finance them through 2020, as the country continues to struggle with violence and instability.
"We see terrorist attacks, we see turmoil and we don't expect this to become easy very soon," NATO Secretary General Jens Stoltenberg said in Warsaw, where the leaders were holding a summit.
Speaking later at a news conference, US President Barack Obama said Afghan forces were much more capable now than when he came into office in 2009, but they still need support "because it's really tough territory and it's a really poor country."
NATO launched its Resolute Support training and advisory mission in Afghanistan last year after ending 13 years of combat operations in the country. Around 13,000 troops from 39 countries are currently taking part in the operation.
Several participating nations had planned to whittle down their presence in Afghanistan this year. But continuing Taliban violence prompted a rethink, especially after the insurgents managed to temporarily overrun the northern provincial capital of Kunduz.
"Our message is clear: Afghanistan does not stand alone and we are committed for the long haul," Stoltenberg said.
"Our aim remains that Afghanistan will never again become a safe haven for terrorists who can pose a threat to our security," leaders from NATO and other Resolute Support partner nations said in a joint statement issued in Warsaw.
Afghan Chief Executive Abdullah Abdullah said his government welcomed the decision to maintain the "current level of support" for Afghan security forces beyond 2016.
Abdullah and Afghan President Ashraf Ghani both attended the Warsaw summit. The Pakistani Foreign Ministry took issue with statements by Ghani at the summit that it described as "hostile," saying that the country is being blamed "for all failures in Afghanistan."
There have been border tensions between the two neighbours recently.
The number of troops participating in Resolute Support next year is expected to stay consistent at around 12,000 soldiers, Stoltenberg said.
Obama announced Wednesday that his country will leave 8,400 troops in Afghanistan into next year, slowing its planned drawdown.
In Warsaw, the US leader defended the need to maintain "a limited partnership" with Afghanistan, saying that the alternative would be "going in, taking out al-Qaeda, pulling out, potentially then seeing a country crumble under the strains of continued terrorist activity or insurgency, and then going back in."
The international community also plays a key role in financing Afghanistan's security apparatus. The country needs about 5 billion dollars a year for its security forces, which number around 350,000.
Afghan troops will continue to be funded through 2020 "at or near" that level, Stoltenberg said. The US provides the lion's share of the financing, with a contribution of 3.45 billion dollars foreseen for next year.
The rest of the international community has pledged more than 800 million dollars annually so far, according to the White House. Stoltenberg said he expected a goal of 1 billion dollars to be met.
The Afghan government also helps fund its security forces. Last year, it contributed 421 million dollars, according to the White House. The goal is for the country to assume the full financial responsibility for its security sector by 2024.
In exchange for its support, the international community called on the Afghan government Saturday to do more on reforms and issues such as tackling corruption.
"There is a close connection between our support and our expectation that they will increase their efforts to modernize their own society," Stoltenberg said.