His legacy forever linked to an unpopular war, US President George W. Bush flew under intense security to Iraq on Sunday where he called the nearly six-year conflict hard but necessary to protect the United States and give Iraqis hope. "The war is not over," he declared. Bush got a size-10 reminder of the intense opposition to his policies when a man threw two shoes at him - one after another - during a news conference with Iraq Prime Minister Nouri al-Maliki. "This is the end!" shouted the man, later identified as Muntadar al-Zeidi, a correspondent for Al-Baghdadiya television, an Iraqi-owned station based in Cairo, Egypt. Bush ducked both throws. Neither leader was hit. "All I can report is a size 10," the president joked. Bush visited the Iraqi capital just 37 days before he hands the war off to President-elect Barack Obama, who has pledged to end it. The president wanted to highlight a drop in violence in a nation still riven by ethnic strife and to celebrate a recent US-Iraq security agreement, which calls for US troops to withdraw from Iraq by the end of 2011. "There is still more work to be done," Bush said after his meeting with al-Maliki, adding that the agreement puts Iraq on solid footing. "The war is not over." In many ways, the unannounced trip was a victory lap without a clear victory. Nearly 150,000 US troops remain in Iraq fighting a war that is intensely disliked across the globe. More than 4,209 members of the US military have died in the conflict, which has cost US taxpayers $576 billion since it began five years and nine months ago. Polls show most Americans believe the US erred in invading Iraq in 2003. Bush ordered the nation into war against Saddam Hussein's Iraq while citing intelligence claiming the Mideast nation harbored weapons of mass destruction. The weapons were never found, the intelligence was discredited, Bush's credibility with US voters plummeted and Saddam was captured and executed. For Bush, the war is the issue around which both he and the country defined his two terms in office. He saw the invasion and continuing fight as a necessary action to protect Americans and fight terrorism. Though his decision won support at first, the public now has largely decided that the US needs to get out of Iraq. In the news conference with al-Maliki, the US president applauded security gains in Iraq and said that just two years ago "such an agreement seemed impossible." "There is hope in the eyes of Iraq's young," Bush said. "This is the future of what we've been fighting for." Said al-Maliki: "Today, Iraq is moving forward in every field." Air Force One, the president's distinctive powder blue-and-white jetliner, landed at Baghdad International Airport in the afternoon local time after a secretive Saturday night departure from Washington. In a sign of security gains in this war zone, Bush received a formal arrival ceremony - a flourish absent in his three earlier trips. Bush soon began a rapid-fire series of meetings with top Iraqi leaders. He met first with Iraqi President Jalal Talabani and the country's two vice presidents, Tariq al-Hashemi and Adel Abdul-Mahdi, at the ornate, marble-floored Salam Palace along the shores of the Tigris River. Defending the war, Bush said, "The work hasn't been easy, but it has been necessary for American security, Iraqi hope and world peace." Later, Bush's motorcade pulled out of the heavily fortified Green Zone and crossed over the Tigris so he could meet al-Maliki at the prime minister's palace. A huge orange moon hung low over the horizon as Bush was ferried quickly through the city. The two leaders sat down together for probably the last time in person in these roles. They signed a ceremonial copy of the security agreement - a "remarkable document," according to Bush's national security adviser, Stephen Hadley. He said the pact was unique in the Arab world because it was publicly debated, discussed and adopted by an elected parliament. Hadley said the trip proved that the US-Iraq relationship was changing "with Iraqis rightfully exercising greater sovereignty" and the US "in an increasingly subordinate role." The Bush administration and even White House critics credit last year's military buildup with the security gains in Iraq. Last month, attacks fell to the lowest monthly level since the war began in 2003. Still, it's unclear what will happen when the US troops leave. While violence has slowed in Iraq, attacks continue, especially in the north. At least 55 people were killed Thursday in a suicide bombing in a restaurant near Kirkuk. It was Bush's last trip to the war zone before Obama takes office Jan. 20. Obama won an election largely viewed as a referendum on Bush, who has endured low approval ratings because of the war and more recently, the US recession. Obama, a Democrat, has promised he will bring all US combat troops back home from Iraq a little over a year into his term, as long as commanders agree a withdrawal would not endanger American personnel or Iraq's security. Obama has said that on his first day as president, he will summon the Joint Chiefs of Staff to the White House and give them a new mission: responsibly ending the war. Obama has said the drawdown in Iraq would allow him to shift troops and bolster the US presence in Afghanistan. Commanders there want at least 20,000 more forces but cannot get them unless some leave Iraq. The trip was conducted under heavy security and a strict cloak of secrecy. People who made the 10Â½-hour trip with the president agreed to tell almost no one about the plans, and the White House released false schedules detailing activities planned for Bush in Washington on Sunday. The new US-Iraqi security pact, which goes into effect next month, replaces a UN mandate that gives the US-led coalition broad powers to conduct military operations and detain people without charge if they were believed to pose a security threat. The bilateral agreement changes some of those terms and calls for all American troops to be withdrawn by the end of 2011, in two stages. The first stage begins next year, when US troops pull back from Baghdad and other Iraqi cities by the end of June. Gen. Raymond Odierno, the top US commander in Iraq, said Saturday that even after that summer deadline, some US troops will remain in Iraqi cities.