In front of a small, hand-picked audience at the headquarters of the NATO mission, the green-and-white flag of the International Security Assistance Force was ceremonially rolled up and sheathed, and the flag of the new international mission called Resolute Support was hoisted.
US Gen. John Campbell, commander of ISAF, commemorated the 3,500 international soldiers killed on Afghan battlefields and praised the country's army for giving him confidence that they are able to take on the fight alone.
"Resolute Support will serve as the bedrock of an enduring partnership" between NATO and Afghanistan, Campbell told an audience of Afghan and international military officers and officials, as well as diplomats and journalists.
"The road before us remains challenging, but we will triumph," he added.
Beginning Jan 1, the new mission will provide training and support for Afghanistan's military, with the US accounting for almost 11,000 of the 13,500 members of the residual force.
"Thanks to the extraordinary sacrifices of our men and women in uniform, our combat mission in Afghanistan is ending, and the longest war in American history is coming to a responsible conclusion," US President Barack Obama said in a statement issued in Hawaii, where he is on vacation with his family.
Afghan President Ashraf Ghani, who took office in September, signed bilateral security agreements with Washington and NATO allowing the ongoing military presence. The move has led to a spike in violence, with the Taliban claiming it as an excuse to step up operations aimed at destabilizing his government.
ISAF was set up after the US-led invasion as an umbrella for the coalition of around 50 nations that provided troops and took responsibility for security across the country. It ends with 2,224 American soldiers killed, according to an Associated Press tally.
The mission, which was initially aimed at toppling the Taliban and rooting out al-Qaida following the Sept 11, 2001 attacks, peaked at 140,000 troops in 2010. Obama ordered a surge to drive the insurgents out of strategically important regions, notably in the southern provinces of Helmand and Kandahar, where the Taliban had its capital from 1996 to 2001.
Taliban spokesman Zabihullah Mujahid called Sunday's event a "defeat ceremony" and said the insurgents' fight would continue.
"Since the invasion in 2001 until now, these events have been aimed at changing public opinion, but we will fight until there is not one foreign soldier on Afghan soil and we have established an Islamic state," he said.
Obama recently expanded the role of US forces remaining in the country, allowing them to extend their counter-terrorism operations to the Taliban, as well as al-Qaida, and to provide ground and air support for Afghan forces when necessary for at least the next two years.
In a tacit recognition that international military support is still essential for Afghan forces, national security adviser Mohammad Hanif Atmar told the gathered ISAF leaders: "We need your help to build the systems necessary to ensure the long-term sustainability of the critical capabilities of our forces."