KABUL, Afghanistan — President Barack Obama praised U.S. troops here early Wednesday as “the new Greatest Generation” as he credited them with the killing of Osama bin Laden a year ago.

“A year ago we were able to finally bring Osama bin Laden to justice,” the president told about 3,200 troops at the Bagram Air Field, drawing a “Hoo-ah” from the crowd.

“That could have only happened because of each and every one of you in your own way were doing your own job. Each and every one of you without a lot of fanfare, without a lot of fuss, you did your jobs.”

Obama returned to Bagram – where he landed late Tuesday local time – to deliver the remarks after after meeting with Afghan President Hamid Karzai to sign a U.S.-Afghan strategic partnership agreement to begin the handover of the security lead there to Afghan forces. Obama is set to deliver a second, longer speech to the nation at 7:30 p.m. Eastern time.

“We did not choose this war. This war came to us on 9/11,” Obama said. “When we see our homeland violated, when we see our fellow citizens killed, then we understand what we have to do. And because of the sacrifices now of a decade and a new greatest generation, not only were we able to blunt the Taliban momentum, not only were we able to drive Al Qaeda out of Afghanistan, but slowly and systematically we were able to decimate the ranks of Al Qaeda,” eventually with the killing of bin Laden.

Obama spent much of his speech thanking the troops.

“When the final chapter of this war is written, historians will look back and say, not only was this the greatest fighting force in the world, but all of you also represented the values of America in an exemplary way,” he said.

The president was introduced by Gen John Allen, who also said the troops’ efforts would be on the minds of world leaders when they gather for the NATO summit in Chicago later this month.

“When they are in Chicago they are going to celebrate your achievement and they’re going to plan the future of this great cause,” Allen said.

But Obama’s speech wasn’t quite a declaration of victory in the war on terror or the war in Afghanistan.

“I know it’s still tough, I know the battle’s not yet over,” he said. “Some of your buddies may get injured, some of your buddies may get killed. And there’s going to be heartbreak and pain and difficulty ahead, but there’s a light on the horizon because of the sacrifices you’ve made.”

Obama also took time to mention the Joining Forces Initiative he has been promoting with first lady Michelle Obama, which works with the families of troops stationed abroad.

“I want everybody here to know that when you get home, we are going to be there for you when you are in uniform and we will stay there for you when you are out of uniform because you’ve earned it,” Obama said. “You’ve earned a special place in our hearts and I could not be prouder to be your commander-in-chief.”