In a highly political election-year address from outside Kabul, Obama posed as a commander-in-chief who ended two long wars  and crushed al-Qaida, and tried to conjure up a new dawn for a nation exhausted by conflict and recession.
"This time of war began in Afghanistan, and this is where it will end," Obama said, recalling a decade-long "dark cloud of war," as America fell into an Afghan quagmire after bin Laden plotted the September 11 attacks in 2001.
"Yet here, in the pre-dawn darkness of Afghanistan, we can see the light of a new day on the horizon," said Obama, seeking to use political capital earned by bringing troops home to validate his request for a second White House term.
Obama earlier dropped from night skies into Kabul amid secrecy and tight security and signed a deal with President Hamid Karzai, cementing 10 years of U.S. aid for Afghanistan after NATO combat troops leave in 2014.
"Neither Americans nor the Afghan people asked for this war, yet for a decade we've stood together," Obama said at the signing ceremony.
"We look forward to a future of peace. We're agreeing to be long-term partners," said Obama, who later headed home aboard Air Force One after just six hours on the ground.
The pact, agreed last month, sees the possibility of American forces staying behind to train Afghan forces and pursue the remnants of al-Qaida for 10 years after 2014.
It does not commit Washington to specific troop or funding levels for Afghanistan, though is meant to signal U.S. foes that despite ending the longest war in U.S. history, Washington intends to ensure Afghanistan does not revert to a haven for terror groups like al-Qaida.
But after a war that has cost the lives of nearly 3,000 U.S. and allied troops, maimed tens of thousands more, saw thousands of Afghans killed and cost hundreds of billions of dollars, Afghanistan's future is deeply uncertain.
Obama trod a delicate political line, reassuring Americans the war was ending but steeling them for possible sacrifices to come -- all while trying to pivot politically back to the need to rebuild at home.
Furious Republicans have accused him of exploiting the heroism of Navy SEAL special forces who conducted the raid to kill al-Qaida chief bin Laden deep in Pakistan exactly a year ago.
But the president, who faces a tough reelection fight, did not shirk from presenting himself as the man to shepherd his country out of "a decade of conflict abroad and economic crisis at home."
"It is time to renew America," Obama said against a backdrop of military vehicles in their sandy desert liveries.
"A united America of grit and resilience, where sunlight glistens off soaring new towers in downtown Manhattan, and we build our future as one people, as one nation," he said.
Though he sought to put a capstone on the war, Obama's statement effectively meant that U.S. troops could be fighting for two more years, and some could remain in danger for a decade after that.
And Obama bluntly told U.S. soldiers there was more suffering to come.
"It's still tough, the battle is not yet over. Some of your buddies are going to get injured, some of your buddies may get killed," Obama said.
"There is going to be heartbreak and pain and difficulty ahead, but there is a light on the horizon because of the sacrifices you have made."