US President George W. Bush made a surprise farewell visit Monday to Afghanistan, where he warned of a long struggle ahead to restore stability seven years after ordering troops into the country. Bush landed in pre-dawn darkness after an equally secretive stop in Iraq, where an angry Iraqi reporter threw two shoes at him in a powerfully symbolic indication of lingering hostility there toward the outgoing US leader. The president's visit to the two countries which will arguably most define his legacy comes just over a month before he hands the keys of the White House to his successor Barack Obama on January 20. Bush landed at Bagram Air Base near Kabul, virtually all lights on his Air Force One official plane turned off as part of a thick shroud of secrecy to ensure his safety. After addressing hundreds of US troops at the base, he flew by Blackhawk helicopter to Kabul for talks with Afghan President Hamid Karzai. Bush acknowledged the difficulty of restoring peace to Afghanistan, where 70,000 foreign troops are fighting an insurgency that has grown increasingly violent since a US-led coalition ousted the hardline Taleban regime in 2001. “This is going to be a long struggle,” he told a joint news conference with Karzai at the presidential palace. “Ideological struggles take time.” “Are there difficult days ahead?” he asked. “Absolutely. But are the conditions a lot better today in Afghanistan than they were in 2001? Unquestionably, undoubtedly they're better.” This year has been the bloodiest for foreign forces here since the Taleban fell, and General David McKiernan, the top commander, has asked for more than 20,000 extra US soldiers to counter rising violence. Karzai said Afghanistan was grateful for the help, saying its people “don't want to be a burden on the international community for ever.” Asked about a possible timetable for a withdrawal of foreign troops, Karzai indicated now was not the time to talk about pulling out. “Afghanistan will not allow the international community leaving before we are fully on our feet, before we are strong enough to defend our country, before we are powerful enough to have a good economy,” he said, joking “and before we have taken from President Bush and the next administration billions and billions of more dollars. No way!” Bush earlier warned that the ramp-up in troop levels would inevitably lead to increased violence. “You'll see violence tick up,” he told reporters on Air Force One en route here, drawing a comparison with the “surge” that helped bring violence down in Iraq and paved the way for some progress toward political reconciliation. “The degree of difficulty in Afghanistan is high,” he said. “Nevertheless, the mission is essential.” He laughed off the shoe incident in Baghdad, which marred his fourth and final trip there since he ordered the March 2003 invasion that toppled Saddam Hussein. Hundreds of Iraqis joined anti-US demonstrations against Bush's visit. During one in Baghdad's Sadr City, the bastion of radical anti-US cleric Moqtada Al-Sadr, protesters threw shoes at passing US military vehicles. Bush has staunchly defended the invasion, despite a deadly insurgency and sectarian violence that since 2003 has killed tens of thousands of Iraqis and more than 4,200 American troops. As he and Maliki signed a security pact setting out new guidelines for US soldiers in Iraq, Bush said: “The war is not over, but with the conclusion of these agreements... it is decisively on its way to being won.” Meanwhile, seven members of a single family from the ancient Yazidi religious sect were gunned down in their home as violence killed 18 people in Iraq on Monday in the wake of US President George W. Bush's farewell visit. Police in Sinjar, a town near the Syrian border, said the three women and four men who died were killed by a group of armed men, though the mayor said there was a single attacker, “apparently bent on tribal vengeance.” Eight Iraqi police officers were also killed and 10 police and soldiers wounded by an explosion west of Baghdad, the US military said. “Eight Iraqi policemen were killed in an attack by a suicide vehicle-borne improvised explosive device in Nasir Was Salam,” it said, adding that the wounded were two Iraqi soldiers and eight police.