U.S. President George Bush is on his way home from a surprise visit to American troops in Afghanistan, where he said progress is being made and the situation is getting better.

Bush dropped in on the war zone while en route from his final trip to Iraq.

In the pre-dawn hours Bush met with roughly 1,000 cheering U.S. troops at Bagram Air Base near Kabul, discussing progress that has been made in the country so far.

"Afghanistan is a dramatically different country than it was eight years ago," Bush said. "We are making hopeful gains."

The outgoing president then moved on to meet with Afghan President Hamid Karzai at his palace in Kabul, Bill Graveland of The Canadian Press told CTV's Canada AM.

The visit came after three Canadian soldiers were killed in Afghanistan on the weekend.

Their bodies were loaded on a military transport during a ramp ceremony late Sunday night, to be flown home.

Bush was surrounded by intense security while in Afghanistan.

One day earlier, while he was holding a news conference in Iraq, Bush had to dodge an impromptu assault when an Iraqi journalist removed his shoes and hurled them at the U.S. president.

Bush, with a slight grin on his face, adeptly avoided the projectiles while his security detail arrested the journalist.

Bush will be leaving office next month when U.S. president-elect Barack Obama takes over in the White House.

Graveland said most of Bush's military efforts have been focused on Iraq, and he is not as closely associated with Afghanistan.

Monday's visit was his first in more than two-and-a-half years, and only the second of his presidency.

Karzai, during his welcome to Bush, mentioned that the visit came only after repeated requests, and suggested Afghanistan wasn't a high enough priority for Bush.

"At this point a lot of people are saying it might be president Obama that is going to be remembered for the situation in Afghanistan, and how that turns out at the end is going to be a different matter altogether perhaps," Graveland said.

Bush, during his remarks in Kabul, said many challenges remain for Afghanistan but the U.S. will be a dependable partner.

"I told the president, 'You can count on the United States,'" Bush said. "'Just like you've been able to count on this administration, you'll be able to count on the next administration as well.'"