President Obama and Afghan President Hamid Karzai exchange documents after signing the Strategic Partnership Agreement at the Presidential Palace in Kabul. Photo: REUTERS

President Obama is greeted by Lt. Gen. Curtis “Mike” Scaparrotti, left, and US Ambassador to Afghanistan Ryan Crocker, second left, as he steps off Air Force One at Bagram Air Field in Afghanistan today. (AP)

BAGRAM AIR BASE, Afghanistan — President Barack Obama made a symbolic trip to Afghanistan on Tuesday, arriving on the first anniversary of the killing of al Qaeda leader Osama bin Laden to sign an agreement with President Hamid Karzai that marks a transition in the war while committing the US to another decade of economic and military aid.

Obama said the Strategic Partnership Agreement he signed in Kabul would allow the US to disentangle from Afghanistan, while not specifying funding or troop levels.

The trip came amid complaints by critics that Obama has politicized bin Laden’s death. The president drew cheers in a speech to troops for his single mention of the US raid that killed the mastermind behind the attacks that sparked the decade-long war.

“We did not choose this war. This war came to us on 9/11,” Obama told US troops who had gathered at Bagram Air Base in the middle of the night to hear his speech.

He also delivered a rare prime-time televised address in which he assured Americans that the US role in Afghanistan is shrinking, while also promising long-term aid to the Afghans. “I recognize that many Americans are tired of war,” Obama said. “But we must finish the job we started in Afghanistan and end this war responsibly.”

Obama said his administration has been in direct talks with the Taliban, the first public acknowledgment of the negotiations by the president. “We have made it clear that they can be a part of this future if they break with al Qaeda, renounce violence and abide by Afghan laws,” Obama said.

But senior administration officials said Tuesday that a key part of those talks, a deal to open a Taliban office in Qatar, had stalled.

The pact Obama and Karzai signed outlines a 10-year relationship between Afghanistan and the US after most American forces withdraw from the country in 2014.

The White House said the deal “provides for the possibility of US forces in Afghanistan after 2014, for the purposes of training Afghan forces and targeting the remnants of al Qaeda.” Congress will help determine future funding and troop levels, setting the stage for a potential political battle.

The deal also seeks to address regional concerns about American military influence in the region by clearly stating that the US doesn’t want permanent military bases in Afghanistan. Instead, American forces will rely on Afghan bases to stage missions to fight any remaining al Qaeda forces in the region and to train Afghan troops.

Obama’s trip, which wasn’t publicly announced beforehand for security reasons, follows a series of efforts by the White House and the Obama campaign to commemorate the bin Laden killing, which the president’s advisers see as his crowning national security achievement.

Those efforts have brought charges from Republicans, including presumptive Republican nominee Mitt Romney, that the president and his aides are inappropriately using the anniversary for political gain.

But Obama drew praise from some GOP leaders for his Afghanistan strategy. Sen. Lindsey Graham (R-S.C.), a frequent critic, said the deal “will help secure our nation and allies from future attacks using Afghanistan as a staging area.” Sen. John McCain (R-Ariz.), who has complained about Obama’s references to bin Laden, praised the president’s trip to Afghanistan and said he hoped the new agreement “will send a signal to friends and enemies in the region that the United States is committed to a secure and free Afghanistan.”

Senior administration officials, while acknowledging the symbolism of scheduling Obama’s visit around the anniversary of bin Laden’s death, told reporters traveling with the president that the trip was driven by negotiations over the strategic-partnership agreement. Obama and Karzai both wanted to sign the agreement in Afghanistan before the North Atlantic Treaty Organization summit in Chicago this month, the officials said.