US President Barack Obama saluted Sunday the "milestone" end of NATO`s combat mission in Afghanistan, but warned the country remains "a dangerous place."

A low-key ceremony in Kabul marked the formal end of NATO`s war after 13 years of conflict that have left the country in the grip of worsening insurgent violence.

As of January 1, the US-led International Security Assistance Force (ISAF) combat mission, will be replaced by a NATO "training and support" mission.

Obama called the ceremony "a milestone for our country."

"For more than 13 years, ever since nearly 3,000 innocent lives were taken from us on 9/11, our nation has been at war in Afghanistan," he said in a statement.

"Now, 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."

Obama thanked the troops and intelligence workers who served in Afghanistan, crediting them with "devastating the core Al-Qaeda leadership, delivering justice to Osama bin Laden, disrupting terrorist plots and saving countless American lives."

"We are safer, and our nation is more secure, because of their service."

And he honored those who were wounded or killed in the long war, including more than 2,200 US soldiers who lost their lives to make "this progress possible."

But, Obama warned, "Afghanistan remains a dangerous place, and the Afghan people and their security forces continue to make tremendous sacrifices in defense of their country."

Under a bilateral agreement with Kabul, about 12,500 foreign troops will remain in Afghanistan. They 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.

That`s down from around 130,000 troops from 50 nations at the 2011 peak.

The remaining soldiers "will continue to face risks," Obama said, emphasizing "the enduring commitment of the United States to the Afghan people."