BALAD, Iraq - U.S. Defence Secretary Robert Gates urged Middle East nations to support the fight against terror Saturday then travelled to Iraq to meet with commanders as the U.S. prepares to cut its troops levels and begin to pull forces out of the cities.

The unannounced visit to Iraq on Saturday comes as President-elect Barack Obama prepares to take office and begin to implement what many expect will be an accelerated withdrawal of troops. During Obama's presidential campaign, he said he wanted combat troops out of Iraq in 16 months, but he has also said he would listen to the advice of his commanders on the ground.

A security agreement between the U.S. and Iraq mandates that combat forces leave the cities by next June, and leave Iraq in three years.

Earlier in Bahrain, Gates urged Middle East nations to help fight the spread of violent extremism by funding and training Afghan security forces and reaching out more aggressively to the fledgling government in Iraq.

Gates also assured the gathering of Persian Gulf leaders in Bahrain that Obama will continue the U.S. commitment to the Middle East, including efforts to fight terrorism and develop a two-state solution between Israel and the Palestinians.

And as the lone Republican holdover from the Bush Cabinet to the Obama team, Gates issued a public warning that any effort by terrorists to test the new administration would be a mistake because there has been extensive planning to ensure a smooth transition.

"Anyone who thought that the upcoming months might present opportunities to 'test' the new administration would be sorely mistaken," Gates said. "President Obama and his national security team, myself included, will be ready to defend the interests of the United States and our friends and allies from the moment he takes office on Jan. 20."

Saying that a stable Iraq can play an important role in the region, Gates urged Gulf leaders to set aside old hostilities inflamed in the Saddam era and forge diplomatic ties with Iraq.

Gates has persistently pressed Middle East nations to provide political, economic and overall support to Iraq, saying that if that country falls back into extremist control it will be a threat to the entire region.

On Iran, his speech struck a more reserved tone this year, compared with his sharper criticism in remarks here last year of Tehran as a chaotic and destabilizing threat. He and others have rebuked Iran for helping bolster militants who then cross the border back in to Iraq. Officials have long believed that Iran -- at some level -- has provided funding and training to insurgents, and supported the delivery of lethal explosives to Iraq.

On Saturday, Gates pressed Gulf nations to impose sanctions on Iran but added that they can be even more influential "by welcoming the new Iraq into the Arab fold."

Withholding support for the country, he said, increases the risk that Iraq will be overcome by Iranian influence that has already cost many lives.

Asked later about Iran, Gates said Tehran is meddling and attempting to destabilize the region, but said the U.S. is not working for a regime change there, just a change in Iran's behaviour. He said the incoming Obama administration is "under no illusion about Iran's behavior and what Iran has been doing in the region" and what it has been doing to increase it's weapons program, including it's pursuit of nuclear power.

He offered a similar message on Afghanistan, saying that a failed state there will increase the chances that al-Qaida and other extremists will take hold again -- a threat that would stretch across the Middle East and beyond.

"An enduring requirement is the ability to rapidly train, equip, and advise Afghan security forces," said Gates, asking that Gulf nations fund and send forces -- including engineers and agricultural experts.

Gates said that while he is prepared to send an additional 20,000 troops to Afghan, he is concerned about having the foreign military force be too large and appear more like occupiers.

Gates held private meetings in Manama on Friday with officials from the Gulf Cooperation Council, which is made up of the six oil-rich nations of Saudi Arabia, Bahrain, Kuwait, Oman, Qatar and the United Arab Emirates.