KABUL - NATO will hold a ceremony in Kabul later Sunday formally ending its war in Afghanistan, officials said, 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.
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 the 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.
A NATO official said US General John Campbell, the ISAF commander, would lead Sunday afternoon's ceremony at the force's headquarters in Kabul.
No other details were released for security reasons.
"In just a few days, our combat mission in Afghanistan will be over," US President Barack Obama said in his Christmas Day address. "Our longest war will come to a responsible end."
Sunday's ceremony completes the gradual handover of responsiblity to the 350,000-strong Afghan forces, who have been in charge of nationwide security since the middle of last year.
But recent bloodshed has undermined claims that the insurgency is weakening and has highlighted fears that the international intervention has failed as Afghanistan faces spiralling violence.
The United Nations says that civilian casualties hit a record high in 2014, jumping by 19 per cent with 3,188 civilians killed by the end of November.
Afghan's police and army have also suffered a grim death toll on the battlefield, with fatalities soaring to more than 4,600 in the first 10 months of 2014 -- far higher than all ISAF deaths since 2001.
"The US and NATO mission was an absolute failure as today's ceremony shows," Taliban spokesman Zabihullah Mujahid told AFP.
"They are fleeing from Afghanistan. They have not reached their goals in defeating the Afghan mujahideen, but they are keeping some forces here to reach their vicious aims."
US commanders insist Afghan security forces can hold the line against the Taliban despite concerns of a repeat of Iraq, where an American-trained army virtually collapsed in the face of a jihadist onslaught.
Since 2001, billions of dollars of aid have been spent in Afghanistan on new schools, hospitals, roads and promoting women's rights, but corruption has been endemic and progress limited even in the cities.
This year's presidential election, which was meant to be the flagship legacy of the development effort, was marred by fraud and a prolonged stand-off between the two poll rivals that fanned further unrest.
Ashraf Ghani eventually emerged as the new president in a power-sharing deal with Abdullah Abdullah.
But their "unity government" has failed to appoint any new ministers three months after taking power.
Ghani hopes to bring peace to Afghanistan after decades of conflict, saying he is open to talks with any insurgent group.
Hamid Karzai, president from 2001 until 2014, opened preliminary contacts with the Taliban but they collapsed acrimoniously last year.
US troops in Afghanistan will be halved by the end of next year, before being reduced to an embassy protection presence by the end of 2016.
The US will continue to provide some air support for the Afghan military, and may extend operations if required to prevent rapid Taliban advances.
One rocket landed on Saturday inside Bagram, the largest ISAF air base, causing no casualties. The Taliban claimed responsibility for the attack.
Recent Taliban targets in Kabul have included foreign guesthouses, diplomatic convoys and Afghan army buses.