HONOLULU — President Obama for the first time used his Christmas Day visit to the troops to talk about the end of America’s longest war.

“We’ve been in continuous war now for over 13 years,” Mr. Obama told troops gathered in the mess hall at Marine Corps Base Hawaii. “Next week we will be ending our combat mission in Afghanistan.”

“Hurrah!” one service member shouted.

Mr. Obama continued, “Because of the extraordinary service of the men and women in the armed forces, Afghanistan has a chance to rebuild its own country.”

The president, with his wife, Michelle, visited service members at the military base, not far from their vacation home in Kailua. It has become an annual tradition for the Obamas, who spend two weeks vacationing in Hawaii — where the president spent much of his childhood — each holiday season.