* U.N. chief Ban withdraws invite after day of confusion
* Washington demanded Ban withdraw offer to Tehran
* Syria's opposition threatened to pull out of talks
* Diplomats saw entire conference in jeopardy
U.N. chief Ban Ki-moon withdrew a last-minute invitation to Iran to attend peace talks on Syria on Monday after the Syrian opposition threatened to boycott this week's conference if President Bashar al-Assad's main sponsor took part.
Ending nearly 24 hours of confusion that dismayed diplomats who have spent months cajoling Assad's opponents to negotiate, Ban's spokesman said Iran was no longer welcome at the initial day of talks at Montreux, Switzerland on Wednesday.
The opposition immediately withdrew its threat to stay away from the conference known as Geneva-2. But the uproar over Iran, which has provided Assad with money, arms and men, underlined the difficulties of negotiating an end to a bloody, three-year civil war that has divided the Middle East and world powers.
Ban, his spokesman said, made the invitation to Iran after Iranian officials assured him they supported the conclusion of a U.N. conference in 2012, known as Geneva-1, which called for a transitional administration to take over power in Syria - something neither Assad nor Tehran have been willing to embrace.
Throughout Monday Iranian officials made clear that they were not endorsing that conclusion as a basis for the talks.
"The secretary-general is deeply disappointed by Iranian public statements today that are not at all consistent with that stated commitment," Ban's spokesman Martin Nesirky told reporters at a briefing.
"He continues to urge Iran to join the global consensus behind the Geneva Communique. Given that it has chosen to remain outside that basic understanding, he has decided that the one-day Montreux gathering will proceed without Iran's participation."
While rebels and their Western and Arab allies see the 2012 accord as obliging Assad to step down, the Syrian leader has support from Iran in rejecting that view. Russia, too, though a participant in the 2012 accord and co-sponsor of this week's first direct peace negotiations, says outsiders should not force Assad out. Moscow has said Iran should be at the talks.
Syria's opposition National Coalition had said it would not take part if Iran did, threatening to wreck painstaking months of diplomatic effort in bringing representatives of the two sides to the table. It welcomed Ban's change of heart.
"We appreciate the United Nations and Ban Ki-moon's understanding of our position. We think they have taken the right decision," Monzer Akbik, chief of staff of the coalition's president, told Reuters.
"Our participation is confirmed for 22 January."
Expectations are low all round, but Western diplomats, some of whom had spoken of a "mess" and "disaster" after Ban's unexpected invitation to Iran late on Sunday, said the talks could now provide some start to easing a conflict that has killed over 130,000 Syrians and made millions refugees.
"We are hopeful that, in the wake of today's announcement, all parties can now return to focus on the task at hand, which is bringing an end to the suffering of the Syrian people and beginning a process toward a long-overdue political transition," U.S. State Department spokeswoman Jen Psaki said in a statement.
Washington had earlier called on the United Nations to rescind the invitation to Tehran.
Adding to clouds over prospects for accord, however, Assad said he might seek re-election this year, effectively dismissing any talk of negotiating an end to his rule.
DISPUTE OVER 2012 ACCORD
Ban has said his invitation was based on an assurance from Foreign Minister Mohammad Javad Zarif that "Iran understands that the basis for the talks is the full implementation of the 30 June 2012 Geneva communique."
But other officials appeared to contradict him before Iran's U.N. ambassador issued Tehran's unambiguous statement saying that the country would definitely not take part if it was required to accept a June 2012 deal agreed in Geneva.
"If the participation of Iran is conditioned to accept Geneva I communique, Iran will not participate in Geneva II conference," Mohammad Khazaee said.
Russia said there was no point in a conference without Iran. It did not immediately react to Ban's change of heart.
"Not to ensure that all those who may directly influence the situation are present would, I think, be an unforgivable mistake," Foreign Minister Sergei Lavrov said.
Saudi Arabia, Iran's regional foe and the rebels' main sponsor, had said Iran should not be permitted to attend because it had troops on the ground aiding Assad.
ASSAD TO SEEK RE-ELECTION
The conference had already appeared highly unlikely to produce any major steps toward ending the war. Western and rebel demands that Assad end four decades of rule by his family seem less realistic now after a year that saw Assad's position improve both on the battlefield and in the diplomatic arena.
His forces recovered ground, rebels turned against one another and Washington abandoned plans for air strikes, ending two years of speculation that the West might join the war against him as it did against Libya's Muammar Gaddafi in 2011.
In an interview on Monday with news agency AFP, Assad declared that he was likely to run for re-election later this year, making clear that his removal was not up for discussion.
"I see no reason why I shouldn't stand," Assad said. "If there is public desire and a public opinion in favor of my candidacy, I will not hesitate for a second to run for election."
He ruled out accepting opposition figures as ministers in his government, saying that was "not realistic" and said the Swiss talks should aim to "fight terrorism" - his blanket term for his armed opponents.
A powerful alliance of Islamist rebel groups has denounced the Switzerland talks and refused to attend. Even securing the attendance of the main political opposition National Coalition was a fraught affair, with many groups voting not to go.
Syria is now divided, with mainly Sunni Muslim rebels controlling the north and east, Kurds controlling the northeast and Assad's forces, led by members of his Alawite minority sect, controlling Damascus and the coast.
Western leaders who have been calling for Assad to leave power for three years have curbed their support for his opponents over the past year because of the rise of Islamists linked to al Qaeda in the rebel ranks.
The al Qaeda-linked Islamic State in Iraq and the Levant, which fought battles with other groups and controls the town of Raqqa, imposed sweeping restrictions on personal freedoms in recent days, banning music and images of people.
No faction has the muscle to win a decisive victory on the ground. Rich Sunni Muslim Arab states led by Saudi Arabia are funding and arming the rebels, while Iran and its Lebanese Shi'ite allies Hezbollah back Assad. Violence is spreading into Iraq and Lebanon, and survival is becoming increasingly difficult for the millions of Syrians forced from their homes.
Syria is one of the biggest issues dividing Tehran from the West at a time when relations marked by decades of hostility have otherwise started to thaw with the election of comparatively moderate president Hassan Rouhani in Tehran.
Global powers agreed in November to ease U.S. and European Union sanctions on Iran in return for curbs to its nuclear programme, and some sanctions were suspended on Monday, but the thaw has so far had little impact on Syria diplomacy.