WASHINGTON — During a surprise trip to Afghanistan on Sunday, President Obama thanked US troops for their service during a decade of war, saying that their sacrifices had ensured the country would never again be used as a base for terrorist attacks against the United States.
“I thank you as your commander in chief because you inspire me,” Obama told about 3,000 troops in a hangar at Bagram Air Field after landing in the country early Sunday morning. “I’m here to say thank you. And I’m here to say how proud I am of you.”
The trip was unannounced, and Obama slipped out of the White House secretly Saturday evening ahead of Memorial Day. Country music singer Brad Paisley traveled on Air Force One with Obama to Afghanistan and performed for about an hour before the president spoke.
Obama chose not to meet with Hamid Karzai, the departing president of Afghanistan, and did not travel to Kabul, the country’s capital. But he vowed that he would work with whomever wins the presidential runoff election scheduled for June 14: Abdullah Abdullah or Ashraf Ghani Ahmadzai.
White House officials said the trip was intended as a visit with troops, not as an opportunity for the two presidents to meet. They said US officials offered Karzai the opportunity to meet Obama at the Bagram Air Field, but they said they were not surprised that it did not happen.
In his remarks to the troops, Obama made clear that he still intends to keep a small military force in Afghanistan beyond 2014 despite longstanding resistance to an enduring US presence from Karzai.
Obama’s comments indicated that he may have ruled out the idea of a complete withdrawal of all US forces when the NATO-led combat mission ends this year.
“Once Afghanistan has sworn in its new president, I’m hopeful we will sign a bilateral security agreement that lets us move forward,” Obama said. “And with that bilateral security agreement, assuming it is signed, we can plan for a limited military presence in Afghanistan beyond 2014.”
Obama vowed that “we are going to make sure that Afghanistan can never again — ever — be used to launch a terrorist attack against our country.”
‘‘America’s commitment to the people of Afghanistan will endure,’’ the president said.
Obama got his biggest applause from the troops when he praised them for making sure that “America’s war in Afghanistan will come to a responsible end.” The crowd also roared with approval when the president said he frequently tells corporate leaders, “If you want somebody who can get the job done, hire a vet.”
Obama did not make any major policy announcements in his remarks to the troops. He is expected to wait until he returns to the United States to offer his latest foreign policy and national security vision, during a speech that he is scheduled to give at the US Military Academy graduation on Wednesday.
Obama has said all US combat troops will have left Afghanistan by the end of this year. US officials hope to leave a small contingent of forces beyond the 2014 withdrawal deadline for the international security force in Afghanistan, to allow for more training of Afghan forces and continuing counterterrorism operations.
The visit to Afghanistan comes as Obama prepares to draw the second of two wars to an official close, making good on a promise that he made as a candidate to pull the United States out of such conflicts.