Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

President Barack Obama marked the formal end of the U.S. combat mission in Afghanistan Sunday, saying that after 13 years the longest war in American history was coming to a “responsible conclusion.”

"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," Obama said in a statement that came hours after the United States and NATO formally ended the war with a ceremony Sunday at a military headquarters in Kabul.

Obama said the ceremony marked a milestone for the nation and thanked U.S. troops and intelligence personnel for their "extraordinary sacrifices." Approximately 2,200 American troops were killed in Afghanistan in a war that cost the U.S. $1 trillion since the initial invasion in 2001.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"We are safer, and our nation is more secure, because of their service," he said, adding that the war effort helped the Afghan people reclaim their communities and hold historic democratic elections.

In his own statement on Sunday, Secretary of Defense Chuck Hagel said in 2015 the U.S. would focus on building upon the "hard-fought gains" of the last 13 years and aiding the Afghan government as the countries transitioned to "the next phase of the U.S.-Afghanistan defense relationship."

Obama acknowledged that Afghanistan remained a dangerous place, and that the role of the remaining military presence was as a supporting role to advise and assist Afghan forces. Civilian casualties in the country this year are on track to hit 10,000, and some 5,000 Afghan forces were also killed in 2014.

“Compared to the nearly 180,000 American troops in Iraq and Afghanistan when I took office, we now have fewer than 15,000 in those countries,” he said. “Some 90 percent of our troops are home.”

IN-DEPTH

— Daniella Silva