Bagram (Afghanistan) (AFP) - Afghan President Hamid Karzai was offered a meeting with President Barack Obama at Bagram Air Base outside Kabul but declined, a US official said Sunday.

The official said that Washington was not surprised that the meeting did not work out at short notice, after Obama arrived at the base on a surprise visit after night fell on Sunday.

"As we said, we weren't planning for a bilateral meeting with President Karzai or a trip to the palace, as this trip is focused on thanking our troops," the official said.

"We did offer him the opportunity to come to Bagram, but we're not surprised that it didn't work on short notice.

"The President will likely be speaking by phone with President Karzai in the days to come, and also looks forward to working with Afghanistan's next President after the election is complete."

Obama and Karzai have a testy relationship and Washington has been deeply frustrated by the outgoing Afghan leader's refusal to sign a bilateral security agreement that would allow it to lock in a post-2014 US troop training mission in the country.