BAGHDAD (Reuters) - An Iraqi reporter called President George W. Bush a “dog” and threw his shoes at him on Sunday, sullying a farewell visit to Baghdad meant to mark greater security in Iraq after years of bloodshed.

Just weeks before he bequeaths the unpopular Iraq war to President-elect Barack Obama, Bush sought to underline improved security by landing in daylight and venturing out beyond the city’s heavily fortified international Green Zone.

He declared the war “not over” despite recent gains.

In a sign of lingering anger over the war that will define the Republican president’s foreign policy legacy, an Iraqi journalist shouted in Arabic “this is a goodbye kiss from the Iraqi people, dog,” and hurled his shoes at Bush during a news conference with Prime Minister Nuri al-Maliki.

Throwing shoes at somebody is a supreme insult in the Middle East. One of the shoes sailed over the president’s head and slammed into the wall behind him and he had to duck to miss the other one. Maliki tried to block the second shoe with his arm.

“It’s like going to a political rally and have people yell at you. It’s a way for people to draw attention,” Bush said. “I don’t know what the guy’s cause was. I didn’t feel the least bit threatened by it.”

The journalist was leapt on by Iraqi security officials and U.S. secret service agents and dragged from the room screaming and struggling.

Bush’s fleeting visit to Baghdad was aimed at marking the recent passage of a U.S.-Iraq security pact that paves the way for U.S. troops to pull out of Iraqi cities by July next year and withdraw completely by the end of 2011.

It was also meant to hail a recent sharp fall in the sectarian violence and insurgency that raged after the 2003 U.S. invasion to topple Saddam Hussein, and to show support for Iraqi police and soldiers as they take on increasing responsibility.

Asked whether he had come to Iraq on a victory lap, Bush said: “No, I consider it an important step on the road toward an Iraq that can sustain itself, govern itself and defend itself.”

“There’s still more work to be done. The war is not over.”

PRAISE FOR BUSH

Bush thanked U.S. forces for their service in Iraq at a rally of about 1,500 cheering troops inside Saddam’s old al-Faw palace at the sprawling U.S. military base of Camp Victory.

Slideshow ( 6 images )

“The surge is one of the greatest successes in the history of the U.S. military,” Bush said, referring to the decision to send an additional 30,000 troops to Iraq last year.

Bush held talks with President Jalal Talabani and Maliki during the visit. Talabani called Bush a great friend of the Iraqi people “who helped us to liberate our country.”

Maliki, who had a strained look on his face after the shoe-throwing, praised Bush: “You have stood by Iraq and the Iraqi people for a very long time, starting with getting rid of the dictatorship.”

Slideshow ( 6 images )

The U.S.-Iraq security pact, which replaces a U.N. mandate governing the presence of foreign troops, has its critics in Iraq, some of whom doubt the United States will live up to its promise to withdraw.

“We reject this visit, as it occurs at a time when Iraq is still under the U.S. occupation and the U.S. army has the upper hand in controlling the security situation,” said Ahmed al-Massoudi, a spokesman for the parliamentary bloc loyal to anti-American Shi’ite cleric Moqtada al-Sadr.

“This visit is a show of force.”

Though Iraq has slipped down the list of Americans’ concerns as the recession-hit U.S. economy has taken center stage, polls show most people think the war was a mistake.

It will now be left to Obama, a Democrat and early opponent of U.S. military involvement in Iraq, to sort out an exit strategy after he takes office on January 20.

About 140,000 U.S. troops will still be in Iraq nearly six years into a war that has killed more than 4,200 American military personnel and tens of thousands of Iraqis.

DAYLIGHT LANDING

Bush was greeted on the heavily guarded tarmac in Baghdad by the top U.S. commander in Iraq, General Ray Odierno, and U.S. Ambassador Ryan Crocker.

The decision to land in broad daylight reflected confidence that Baghdad was more secure this time than in Bush’s last visit to the capital in 2006 when sectarian violence was raging.

Until Air Force One touched down, Bush’s trip was conducted in strictest secrecy. The presidential jet was rolled out of its giant hangar only after everyone was on board. Journalists’ electronic devices, from cellphones to iPods, were confiscated.

Bush, dressed casually and wearing a black baseball cap after his night-time getaway from the White House, made a rare appearance in the press cabin just before takeoff.

“Nobody knew who I was,” he joked when an aide complimented him on his disguise.