In a crowded aircraft hangar at Joint Base McGuire-Dix-Lakehurst, President Obama told thousands of military service members Monday that they "are the backbone of the greatest nation on Earth," and thanked them for their "selfless character."

Obama also praised base personnel for flying supplies and building infrastructure as part of the fight against Ebola in West Africa, and aerially refueling U.S. warplanes degrading "the brutal terrorist group ISIL in Iraq and Syria."

"When the world calls on America, we call on you - our men and women in uniform - because nobody can do what you do," the president said.

At the same time, he told the crowd, the nation is at a "turning point" as it reduces its military footprint in Afghanistan and Iraq, and disengages from nation-building overseas.

"When I took office, we had nearly 180,000 troops" in the two countries, he said. "By the end of this month, we'll have fewer than 15,000."

Obama said this month marks "an important milestone" for the United States in Afghanistan.

"This month, after more than 13 years, our combat mission in Afghanistan will be over," he said.

U.S. and NATO troops closed their operational command in Afghanistan last week. But the president said the United States would "have a limited military presence there because we've got to keep training and equipping Afghan forces, and we've got to conduct counterterrorism missions because there are still remnants of al-Qaeda there."

"After all the sacrifices you've made, we want to preserve the gains that you've made," he said. "We want a stable and secure Afghanistan."

Going forward, Obama said, "our military will be leaner. But as your commander-in-chief, I'm going to make sure we keep you ready for the range of missions that we ask of you. We're going to keep you the best-trained, the best-led, the best-equipped military in the history of the world, because the world will still be calling."

Obama was joined by Gov. Christie, Democratic U.S. Sen. Robert Menendez, U.S. Reps. Jon Runyan, a Republican, and Donald Norcross, a Democrat, and U.S. Rep.-elect Tom MacArthur, a Republican.

"They were already lobbying me about the base on the way in," MacArthur quipped.

The base is home to 32 KC-10 refueling aircraft. Air Force and Defense Department officials have signaled the Obama administration's intention to phase out the planes. more than half of which are stationed at the Joint Base.

Elimination of these aircraft "would decimate the installation's crucial refueling mission and the valuable human capital that supports it," U.S. Rep. Chris Smith wrote to Obama in a Dec. 12 letter. "Accordingly I urge you to again reject this misguided proposal."

The visit also came as New Jersey works on strategies for inoculating the Joint Base and other military installations from being closed by the Defense Department.

Lt. Gov. Kim Guadagno chairs the New Jersey Military Installation Growth and Development Task Force, which includes Brig. Gen. Michael L. Cunniff, adjutant general for the New Jersey Department of Military and Veterans Affairs, and former U.S. Rep. Jim Saxton.

The 60-square-mile base in Burlington and Ocean Counties provides about 40,000 military and civilian jobs and contributes $7 billion each year to the state economy, according to a Rutgers University study. It also supports 65,000 off-base jobs. About $118.7 million in annual state tax revenues is generated from the operation of the base.

"This is one of our nation's premier joint military bases," said Obama, who then recalled an earlier visit to New Jersey after Hurricane Sandy. "People across this state - including those of you here at this base - you had to pick yourselves up, pull together, rebuild, show that here in New Jersey, here in America, we are stronger than any storm.

"Like a friend of mine from New Jersey likes to say, 'Wherever this flag is flown, we take care of our own.' That's what we do here in New Jersey," the president said. "That's what we do all across America. And this facility exemplifies that spirit. For nearly a century, our flag has flown right here."

On Monday, Obama was warmly greeted by service members during his stopover. "It's great for citizens to see the president," said Sgt. First Class Joe Coker, who lives on the base. "It's definitely special.

"He's taken time out of his busy schedule," Coker said. "I didn't even know he knew where McGuire was."

Obama summed up a key reason for his visit: "Part of the message I'm here to deliver on behalf of the American people is very simple: It's just to say thank you. Thank you for your extraordinary service."