NATO formally ended its war in Afghanistan on Sunday, holding a low-key ceremony in Kabul after 13 years of conflict that have left the country in the grip of worsening insurgent violence.
The event was arranged in secret due to the threat of Taliban strikes in the Afghan capital, which has been hit by repeated suicide bombings and gun attacks over recent years.
"Together... we have lifted the Afghan people out of the darkness of despair and given them hope for the future," NATO commander US General John Campbell told assembled soldiers.
"You've made Afghanistan stronger and our countries safer."
On January 1, the US-led International Security Assistance Force (ISAF) combat mission, which has suffered 3,485 military deaths since 2001, will be replaced by a NATO "training and support" mission.
About 12,500 foreign troops staying in Afghanistan will not be involved in direct fighting, but will assist the Afghan army and police in their battle against the Taliban, who ruled from 1996 until 2001.
When numbers peaked in 2011, about 130,000 troops from 50 nations were part of the NATO military alliance.
"I hope you take great pride in the positive impact you've made and will continue to make upon the Afghan people," Campbell said in a speech released by ISAF on Twitter as live broadcasts were banned for security reasons.
Campbell folded up the ISAF flag and unveiled the flag of the new mission, named Resolute Support.