President Obama paid tribute to the military saying the sacrifices of the American troops have allowed for a more peaceful, prosperous world to come out of the ashes of the 9/11 terrorist attacks.

Obama marked the end of Afghan combat at a Marine Corps base in Hawaii Christmas Day. Obama still remarked about the challenges American troops face in “hotspots” such as Iraq and West Africa.

"Because of the extraordinary service of the men and women in the American armed forces, Afghanistan has a chance to rebuild its own country," Obama said to applause from Marines and their families. "We are safer. It's not going to be a source of terrorist attacks again."

The US is preparing to pull most of its combat troops out of Afghanistan by year’s end after invading the country to strike against Al Qaeda as retribution for the horror of Sept. 11. The U.S. and NATO plan to leave 13,500 troops in Afghanistan for training and battlefield support.

The U.S. is shifting to a supporting role after the bloodiest year in Afghanistan since the 2001 U.S.-led invasion. Civilian casualties this year are on track to hit 10,000, and some 5,000 Afghan forces were also killed in 2014, a figure that has escalated as the country took on a greater role in its own security. Insurgents have seized territory across the country, raising fears that Islamic militants will successfully exploit the security vacuum formed as the U.S. pulls out.

Roughly 2,200 U.S. troops were killed in Afghanistan over the last 13 years in a war that cost the U.S. $1 trillion, plus another $100 billion for reconstruction. A celebratory cheer of "hooah" rang out from the hundreds of troops here when Obama affirmed that the combat mission was finally ending.

"We still have some very difficult missions around the world — including in Iraq," Obama said. But, he added, "the world is better, it's safer, it's more peaceful, it's more prosperous and our homeland protected because of you."

Obama’s visit to the Marines came in the middle of his holiday trip in Hawaii after a tumultuous year in Washington.

After waking up their rented vacation home in Kailua, Obama, his wife and two daughters opened presents and sang carols before pulling up midday in their motorcade to Bellows Air Force Station, a waterfront post with picturesque views of Hawaii's lush green mountains. With a calm breeze rolling in over the ocean, the Obamas spent roughly two hours with friends on the beach looking out at the piercing aquamarine waters of the Pacific Ocean.

The Associated Press contributed to this report