Obama has made Afghanistan, where Taliban and al-Qaida-linked militants are resurgent, a centerpiece of his proposed strategy for dealing with terror threats. The candidate has said the war in Afghanistan deserves more troops and more attention as opposed to the conflict in Iraq.
Earlier in the day during breakfast with soldiers at Camp Eggers, a heavily fortified military base in the city, Obama praised the U.S. troops.
"To see young people like this who are doing such excellent work, with so much dedication ... it makes you feel good about the country," Obama said.
"I want to make sure that everybody back home understands how much pride people take in their work here and how much sacrifice people are making. It is outstanding," he said in video footage from the military obtained by The Associated Press.
Lt. Col. Dave Johnson, a U.S. military spokesman, said Obama and other visiting senators met with many soldiers and sailors from their respective constituencies.
While officially a part of a congressional delegation on a fact-finding tour also expected to take him to Iraq, Obama was traveling in Afghanistan amid the publicity and scrutiny accorded a likely Democratic nominee for president rather than a senator from Illinois. Security was tight and media access to Obama was limited by his campaign.
Traveling with Obama were Sens. Chuck Hagel, a Nebraska Republican, and Jack Reed, a Democrat from Rhode Island. Both are military veterans and have been mentioned as potential Obama vice presidential running mates, although Reed has said he is not interested in the job and Hagel would be an unlikely cross-party choice.
Obama and others in the delegation received a briefing Saturday inside the U.S. base in Jalalabad from the Afghan provincial governor of Nangarhar, Gul Agha Sherzai, a no-nonsense, bullish former warlord.
"Obama promised us that if he becomes a president in the future, he will support and help Afghanistan not only in its security sector but also in reconstruction, development and economic sector," Sherzai told The Associated Press.
The area where the meeting took place is not far from where Osama bin Laden escaped U.S. troops in 2001 after his al-Qaida network led the Sept. 11 terrorist attacks.
Obama's first overseas tour since securing the Democratic nomination - he is scheduled to travel to Europe through next week - could be key to honing his foreign policy strategy with less than four months before the election. His rival for the presidency, Republican Sen. John McCain, has criticized Obama for not spending more time in the region.
The delegation has also met with military leaders and troops at Bagram Air Field, the main U.S. military base north of the capital, and Jalalabad Air Field in Nangarhar province.
Obama advocates ending the U.S. combat role in Iraq by withdrawing troops at the rate of one to two combat brigades a month while increasing the military commitment to Afghanistan.
Obama has proposed sending two more combat brigades - about 7,000 troops - to Afghanistan. McCain is also advocating sending more forces to the war-battered country.
U.S. military officials say the number of attacks in eastern Afghanistan, where most of the U.S. forces in the country operate, has gone up by 40 percent so far in 2008, compared to the same period in 2007.
Gen. David Petraeus, the top U.S. commander in Iraq, told The Associated Press on Saturday that after intense U.S. assaults there, al-Qaida may be considering shifting focus to its original home base in Afghanistan, where American casualties are recently running higher than in Iraq.
Obama has also expressed weariness with the efforts by Afghanistan's neighbor Pakistan to go after militants in its territory. That frustration may strike a chord with Karzai, who has accused Pakistan's intelligence service of supporting the Taliban insurgency - claims that Pakistan denies.
But Obama has also criticized Karzai and his government, saying it had "not gotten out of the bunker" and helped to organize the country or its political and security institutions.