"All of you represent what is best in America," he told the guests. "You serve under our proud flag. You and your families sacrifice more than most of us can ever know -- all in defense of those God-given rights that were first put to paper 236 years ago: life, liberty, and the pursuit of happiness.
"So as your commander-in-chief -- but also as an American -- I want to invite all of you over to say one thing -- thank you."
The party featured music by the Marine Band and country star Brad Paisley. The guest list included members of the Army, Navy, Air Force, Marine Corps and Coast Guard, along with members of their families.
Obama singled out several guests for individual mention, including Army Sgt. Alan Ruehs, "who, in the midst of an enemy ambush in Afghanistan, risked his own life to save the lives of four others." He mentioned Navy Petty Officer Taylor Morris, "who suffered terrible wounds while serving in Afghanistan on an Explosive Ordnance Disposal Team, but who inspires us all through his incredible recovery."
Also singled out were Air Force Col. Charles Barnett, who led almost 200 combat missions in Afghanistan and currently volunteers "to care for our fallen heroes at Arlington National Cemetery"; Marine Cpl. Alex Nguyen, "who sustained serious injuries when his vehicle struck an [improvised explosive device] in Afghanistan, but who carries on stronger than ever"; and Coast Guard Lt. Cmdr. Michelle Watson, "who was one of the first African-American women to graduate from the Coast Guard Academy, and went on to perform exceptional service in Operation Enduring Freedom."
"All the men and women who stand with us here this afternoon are an example of this generation of heroes -- this 9/11 Generation that has earned its place in history alongside the greatest generations," the president said. "Because of your service and sacrifice, all of our troops are now out of Iraq. Because of your service and sacrifice, we took the fight to al-Qaida and we brought Osama bin Laden to justice. Because of your service and sacrifice, we're transitioning out of Afghanistan. We will remain ready for any threat. That is all because of you."
Obama said America "will always remember" its men and women in uniform.
"We will always be there for you, just as you've been there for us," he said. "That's my promise. That is America's promise. And that is one that we pledge to fulfill on this Independence Day."