On a surprise overnight visit to Afghanistan, President Obamatoday marked the one-year anniversary of Osama bin Laden's death and thanked U.S. military service members for their determination and sacrifices during the 11-year-long war.
"The reason that the Afghans have an opportunity for a new tomorrow is because of you, and the reason America is safe is because of you," Obama told a crowd of 3,200 U.S. troops huddled inside a cavernous hangar at Bagram Air Field.
"We did not choose this warm" he added. "This war came to us on 9/11. And there are a whole bunch of folks who signed up after 9/11. We don't go looking for a fight. But when we see our homeland violated, when we see our fellow citizens killed, then we understand what we have to do.
"Slowly and systematically, we have been able to decimate the ranks of al Qaeda," Obama said. "And a year ago, we were able to finally bring Osama bin Laden to justice.
"I know the battle's not yet over," Obama added later. "Some of your buddies are going to get injured and 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 addressed the troops following a meeting with Afghan President Hamid Karzai in Kabul, at which the two leaders signed the Strategic Partnership Agreement that charts a course for the U.S.-Afghanistan relationship beyond 2014, when the final American combat troops will withdraw.
"Neither Americans nor the Afghan people asked for this war, yet for a decade we've stood together," President Obama said at the signing ceremony. "Today, with the signing of the strategic partnership agreement, we look forward to a future of peace. Today, we're agreeing to be long-term partners."
Obama will address the nation live from Bagram Air Base tonight at 7:30 p.m. ET to explain how and why the agreement will ensure U.S. military and financial support for Afghanistan for years to come, officials said.
The arrangement, inked ahead of a NATO summit on Afghanistan in Chicago later this month, is designed to send a message to the region that the U.S. is not abandoning the country even as it sharply reduces its footprint there.
As the Afghan military takes the lead in domestic security operations, U.S. intelligence resources, military aircraft and counterterrorism tools will continue to provide support, officials said.
The arrangement is a nod to lessons learned from 1989 when Russia withdrew from Afghanistan, leading to civil war, the rise of the Taliban and creation of a safe haven from which bin Laden could launch his attacks.
Secret Mission for Obama
Obama touched down at Bagram Air Field just outside the Afghan capital at 1:50 p.m. ET Tuesday, following a roughly 13-hour flight aboard Air Force One that was shrouded in secrecy to protect the president's security.
The trip -- Obama's third to Afghanistan since becoming president -- began shortly after midnight Tuesday eastern time, when Air Force One took off from Joint Base Andrews outside Washington, D.C.
After landing at Bagram at 10:20 p.m. local time, Obama immediately boarded a waiting Chinook helicopter for a 20-minute flight to Kabul, flying under cover of darkness, before landing and motorcading to the Afghan Presidential Palace.
U.S. Ambassador Ryan Crocker and ISAF Commander Lt. Gen. Curtis "Mike" Scaparrotti greeted the president at Bagram and joined him for the trip to visit Karzai. The president was also joined on the trip by Sens. Carl Levin, D-Mich., and Jack Reed, D-R.I., who serve on the Senate Armed Services Committee.
Following the signing ceremony for the Strategic Partnership Agreement, Obama and his entourage traveled by helicopter back to Bagram, where he spokes to military service members -- most from the Army 1st Infantry Division -- inside an empty hangar.
Visit Amid Strained Relations
A semi-annual Pentagon report to Congress released Tuesday on the status of the 11-year war concluded that coalition forces still face "long-term and acute challenges" because of safe havens in Pakistan and "widespread corruption" within the Afghan government "that limits its effectiveness and legitimacy."
Still, the Taliban has been degraded and security in the country has improved over the past six months, according to the report. After five consecutive years during which enemy-initiated attacks rose, they dropped 9 percent in 2011 over 2010 and were down 16 percent in 2012 compared to the year before.
"We are making serious important progress" but "challenges remain," a senior Defense Department official told reporters this week.
A number of bloody incidents involving American and Afghan soldiers and civilians have also complicated the war effort.
In March, a U.S. soldier went on a shooting rampage in an Afghan village, killing 17 civilians including women and children, sparking anti-American protests across the country.
Meanwhile, the number of U.S. service members killed by Afghan allies they worked alongside has continued to climb, with more than a dozen so-called green-on-blue attacks leaving 10 dead Americans dead this year alone.
The inadvertent burning of Korans by American soldiers on a military base earlier this year and photos of troops posing with deceased Afghans and urinating on their corpses have also inflamed U.S.-Afghan relations.
The U.S. and its NATO allies intend to turn over security control to the Afghans by the end of 2014. The U.S. is expected to reduce its force to about 68,000 by the end of September, down from the roughly 88,000 now in Afghanistan.
Obama Re-Elect Pushes Afghan Withdrawal
The U.S. troop withdrawal from Afghanistan has become a major selling point of Obama's re-election campaign.
"Change is the promise we made in 2008," Obama told supporters at a campaign fundraiser in Detroit last month. "For the first time in nine years, there are no Americans fighting in Iraq. We have refocused our efforts on the terrorists who actually attacked us on 9/11. Al Qaeda is weaker than it's ever been. Thanks to our amazing troops, Osama bin Laden no longer walks the face of this Earth."
"We have begun to transition out of Afghanistan. That's what change is," he said.
The latest ABC News/Washington Post poll found a record-high number -- 66 percent -- of Americans believe the Afghanistan war has not been worth fighting, matching opposition to the war in Iraq at its peak five years ago.
As for views of Obama's handling of the war effort, more Americans approve than disapprove of his leadership, 48 to 43 percent.
Tuesday's trip marks Obama's third visit to Afghanistan since he took office in 2009.
He most recently visited Kabul in December 2010, one year after approving a surge of U.S. troops to try and stabilize the war-torn country.
Obama made his first visit as president in March 2010, when he rallied U.S. troops and pressed Karzai in a private meeting to more forcefully combat government corruption and fight Islamic extremism.
ABC News' Luis Martinez, Gary Langer and Mary Bruce contributed to this report.