Baghdad: US President George W. Bush said during a surprise visit to Baghdad on Sunday that the US intervention in Iraq had been difficult but "necessary."

"The work hasn't been easy but it's been necessary for American security, Iraqi hope and world peace," Bush said at a meeting with Iraqi President Jalal Talabani.

"I'm so grateful that I've had a chance to come back to Iraq before my presidency ends," said Bush, on his fourth visit to Iraq since the ousting of Saddam Hussain.

Bush described the US-Iraq security deal that calls for the withdrawal of US troops by the end of 2011 a "reminder of our friendship and a way forward to help the Iraqis to realise the blessings of a free society".

Bush flew secretly to the Iraqi capital to hold talks with Iraqi Prime Minister Nuri Al Maliki and address a rally of US troops.

Bush arrived first by helicopter at the presidential palace for talks with Talabani and his two vice-presidents. He planned to meet later with Al Maliki.

Bush said in a recent ABC interview that the "biggest regret" of his presidency was flawed intelligence that Iraq had weapons of mass destruction.

He used that intelligence as a key justification for going to war. No such weapons were found.