Regional efforts to contain the violence in Iraq gathered pace as as Baghdad and Syria today agreed to restore full diplomatic relations after a 24-year break.The move followed a visit by the Syrian foreign minister, Walid al-Moualem, to Iraq - the first by a Syrian minister since the US-led invasion in 2003.

Mr Moualem pledged cooperation in tackling the growing violence sweeping the country, saying Syria was prepared to work "hand in hand to achieve the security of brother Iraq".

He also signed an accord with his Iraqi counterpart, Hoshiyar Zebari, agreeing that US troops should remain in Iraq for the time being. Previously, he had called for a timetable for the withdrawal of 140,000 US troops.

The accord contained wording used by the Iraqi and US governments, saying troops should gradually withdraw once they were not needed.

Iraq and the US have accused Syria of not doing enough to stop foreign Islamist fighters and weapons crossing the long and porous Iraqi-Syrian border.

Syria says sealing the border is impossible, insisting Iraq must do more to patrol its side.

The Iraqi president, Jalal Talabani, will this weekend fly to Tehran for a three-way summit including Syria. The talks - an initiative of the Iranian president, Mahmoud Ahmadinejad, will focus on how Iraq's neighbours can help staunch the sectarian bloodshed in the country.

The summit initiative, a sign of Iran's diplomatic clout in the region, comes at a time when the US is debating whether to bring in Iran and Syria into diplomatic efforts to calm the situation in Iraq.

Iran and Syria, however, are not waiting for Washington, and have taken the initiative.

The former US secretary of state James Baker, who is leading the Iraq Study Group, has made clear his desire to bring Iran - once described by George Bush as part of the "axis of evil" - into the diplomatic process. Tony Blair has also called for "a new partnership" with Iran and Syria.

However, Mr Bush has insisted that Iran suspends nuclear enrichment before the start of any dialogue, while Syria has also been frozen out because of its links with alleged terrorist organisations such as Hizbullah in Lebanon.

Press reports said Mr Ahmadinejad first proposed three-way negotiations last year, but was refused by the then Iraqi prime minister, Ibrahim Jafari. Mr Jafari and his advisors feared the US would oppose giving Iran any role in Iraq, and doubted Syria's intentions.

The US has sought to play down the significance of the three-way summit, and the state department spokesman, Tom Casey, yesterday said previous statements by Iranian and Syrian leaders had not proved productive.

"What we'd like to see the Iranian government do is desist, first and foremost, from negative actions it's taken in Iraq," Mr Casey added. "As we have always said with respect to the Syrians ... the problem is not what they say, the problem is what they do."

Syria and Iraq are restoring full diplomatic ties following an agreement struck in principle some months ago.

Saddam Hussein and the late Syrian president Hafez al-Assad, leaders of rival wings of the Arab nationalist Ba'ath party, severed ties when Syria sided with Iran during the 1980-1988 Iran-Iraq war.

As diplomatic efforts on Iraq gathered momentum, the UN secretary-general, Kofi Annan - who angered Washington by describing the war in Iraq as illegal - said the US was "trapped".

He urged Washington to carefully consider when would be the best time to pull out of Iraq so withdrawal did not lead to a further deterioration of security.

"The United States, in a way, is trapped in Iraq," Mr Annan said. "It cannot stay and it cannot leave.

"There are those who maintain that its presence is a problem and there are those who say that if it leaves precipitously, the situation will get worse."