president Obama surprising thousands of soldiers in Afghanistan. Unexpected memorial day visit. The president thanking them for their service and saying he hopes only a small number of American troops... See More
president Obama surprising thousands of soldiers in Afghanistan. Unexpected memorial day visit. The president thanking them for their service and saying he hopes only a small number of American troops will remain in the country after this year. ABC's David Kerley has more from the white house. Good morning, David. Reporter: Good morning, Lahr R the president arrived at the white house ten minutes ago, 32-hour trip to thank the troops and send a signal about the continuing American presence in Afghanistan. It was one of those secret trips not announced until the president arrived in the evening darkness surprising even the 3,000 troops gathered. Hello, bagram. Reporter: The president offered solemn remembrances for their lost comrades but then talked about the coming transition. For many of you this will be your last tour in Afghanistan. Reporter: But some may come back. The president who met with the ambassador and top general made it clear he wants to keep a U.S. Presence after the end of this year, the end of combat operations in Afghanistan. Because after all the sacrifices we've made we want to preserve the gains that you have helped to win. And we're going to make sure that Afghanistan can never again ever be used again to launch an attack against our country. Reporter: How many Americans will stay is unclear. It depends on a deal with the future leader of Afghanistan. It won't be the current president Hamid karzai who rejected an invitation to the air base to meet with the president. The two did speak on phone. While it was less than a four-hour visit it was memorable for the troops. Now I'm going to shake every single hand in here. Although I may not be able to take a selfie with everybody. But I'll shake every hand. Reporter: The president spent 90 minutes shaking hands. We may learn more about the American presence down the road in Afghanistan Wednesday when the president speaks at west point. One mistake made during the trip, the white house inadvertently released the name of the cia station chief in Afghanistan. No word on whether he's going to stay in country or come back home. Lara and David. All right, now, he was shaking a lot of happens and say I wouldn't have time for a selfie. You know that president, he likes a selfie. That means a ton to the troops. I hope so.
This transcript has been automatically generated and may not be 100% accurate.