Kaneohe Bay - President Barack Obama marked the end of more than a decade of combat in Afghanistan by paying tribute to America's military, telling troops on Christmas Day that their sacrifices have allowed for a more peaceful, prosperous world to emerge out of the ashes of 9/11.At an oceanfront Marine Corps base in Hawaii, Obama told troops that while tough challenges remain for the US military in hotspots like Iraq and West Africa, the world as a whole is better off because American troops put country first and served with distinction. He said Americans and their president could not be more thankful."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."Thirteen years and $1 trillion later, the US is preparing to pull the vast majority of its combat troops out of Afghanistan by year's end, as the US and its partners seek to turn the page on a bloody chapter that started the day that al-Qaeda militants struck American soil on September 11 2011. From a peak 140 000 troops in 2010, the US and Nato plan to leave just 13 500 behind for training and battlefield support.Although there are reasons for cautious optimism, including a new Afghan president whose seriousness of effort has inspired US confidence, the broader picture still looks glim.The US is shifting to a supporting role after the bloodiest year in Afghanistan since the 2001 US-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 US pulls out.'Hooah'Roughly 2 200 US troops were killed in Afghanistan over the last 13 years in a war that cost the US $1 trillion, plus another $100bn 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."On the US mainland and across the globe, other prominent leaders were fanning out, echoing the president's message with their own Christmas visits and phone calls to American troops.Vice President Joe Biden and his wife, Jill, visited Walter Reed National Military Medical Center in Bethesda, Maryland, to spend time with wounded troops and their families and express gratitude for their service. Defence Secretary Chuck Hagel called military members on deployment, the Pentagon said, including those in Afghanistan and others assigned to US Central Command, which is running the US mission to fight the Islamic State group in Iraq and Syria.Republican senator John McCain was spending Christmas in Kabul, Afghanistan, where the former Navy pilot met Thursday with Afghan President Ashraf Ghani and his chief executive officer, Abdullah Abdullah. A chief critic of Obama's foreign policy, McCain is set to lead the Senate Armed Services Committee next year.