Updated

U.N. Secretary-General Kofi Annan said Tuesday that the United States was "trapped in Iraq," and urged Washington to carefully consider when would be the best time to pull out so the withdrawal does not lead to further violence.

"The United States in a way is trapped in Iraq," 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."

Annan said the departure of U.S. troops from Iraq "should not lead to a further deterioration of the situation." The goal should be to leave when Iraqi authorities can ensure a "reasonable, secure environment," he told reporters during a visit to the U.N. European headquarters in Geneva.

Annan, whose term at the head of the global body ends Jan. 1, said the war in Iraq, and the failure of the U.N. Security Council to prevent the invasion by U.S.-led forces, was the biggest regret he had from his 10-year tenure.

"I firmly believe that the war could have been avoided," he told reporters at the United Nations in Geneva. "The inspectors should have had a bit more time."

• Visit FOXNews.com's Iraq center for more in-depth coverage.

Annan said he welcomed moves to involve Syria and Iran in trying to foster stability in Iraq because it would help bring peace to the region.

"One should not look at it in terms of whether it is helping the United States or multinational forces," he said. "It is their backyard, too, and what is happening in Iraq does have a negative impact on them."

He noted that he had talks in September with President Bashar Assad in Syria and President Mahmoud Ahmadinejad in Iran to encourage them to "be part of the solution" and that he talked to them again by telephone last Saturday.

"If the neighbors who have a role to play could come together and work with the Iraqis to calm the situation it could be positive," he said. "Neighbors can play a positive or a negative role. Neighbors can decide to support one side or the other of the parties in Iraq. They can also decide to work with them to de-escalate."

Annan said that if Syria and Iran believe a peaceful Iraq is in the interest of all its neighbors, they should "use their influence and to do whatever they can to help pacify Iraq."

Both neighbors have given indications they are willing to play a larger role.

Syria and Iraq restored relations on Tuesday, 24 years after they were severed. Iranian President Mahmoud Ahmadinejad has invited his Iraqi and Syrian counterparts to a weekend summit in Tehran to discuss the situation in Iraq.

Syrian President Bashar Assad reportedly has declined the invitation but sent Foreign Minister Walid Moallem on a visit to Baghdad.

"I hope that once he's out I'll be able to talk to him to find out what went on and what was agreed," Annan said.

Iraqi officials say President Jalal Talabani has accepted the Iranian invitation and also would go to Damascus to meet with Assad.

U.S. officials have expressed reservations about the intentions of Iran and Syria.

However, there has been widespread speculation in Washington that an independent U.S. advisory commission on Iraq was considering recommendations to U.S. President George W. Bush that could include a broader role for Syria and Iran.

• Visit FOXNews.com's Iraq center for more in-depth coverage.