By Stephen Gibbs
BBC News, Tegucigalpa
Manuel Zelaya's term as president is officially due to end on 27 January
When news emerged on 28 June that the president of Honduras had been bundled out of his residence at dawn, frog-marched on to a plane, and dumped in his pyjamas on the tarmac of San Jose airport in Costa Rica, it provoked a rare moment in global diplomacy: consensus.
Elected politicians of all persuasions were quick to agree on one thing: that forcing elected politicians out of office at gunpoint is not acceptable.
So, from Caracas to Washington to Havana to London, there was a chorus of condemnation. The only solution to the crisis, it was decided, was an urgent restoration of President Manuel Zelaya to power.
All contact was cut with the interim government. Honduras was expelled from the Organization of American States.
Foreign diplomats left the Honduran capital, Tegucigalpa, in droves. Those who stayed scrupulously avoided meeting representatives of a regime which their governments officially did not recognise. To do so would risk bestowing "legitimacy".
It seemed like The World versus Rogue Honduran State. And it was clear who would win.
But five months on, the global alliance has collapsed as a mixture of exasperation, realpolitik, and reassessment forces founder members to look for an exit route.
The first to crack was the United States.
From the beginning it was in a difficult situation. Many a coup in Latin America has been tolerated - and even instigated - by previous US administrations. There was plenty of suspicion that the dirty hand of Washington might have been behind Mr Zelaya's removal.
Sunday's elections: An end to the drawn-out crisis?
It was the Honduran military, after all, that went to knock on the door of Mr Zelaya with a one-way ticket to Costa Rica - an army that has been expensively trained by US advisers for decades.
In an effort to make it as clear as possible that an Obama administration really is very different from a Reagan one, US diplomats went into damage limitation mode.
Mrs Zelaya and her family moved into the American ambassador's lavish residence. His hospitality was evidence of US displeasure that the first family had been forced out of the presidential palace.
Her husband was flown to Washington, where Secretary of State Hillary Clinton offered support. The US cut military aid to Honduras. The visas of several senior figures in the new government were revoked.
But as the weeks dragged on, it became increasingly apparent that even if Washington didn't like coups, neither did it particularly like President Zelaya.
It wasn't just that the flamboyant, Stetson-wearing rancher had kind words for the United States' main critic in the region, Venezuelan President Hugo Chavez. His sometimes eccentric behaviour also alarmed Washington.
The State Department was irritated by Mr Zelaya's theatrical attempts to return to his country, first in a Venezuelan Learjet, and secondly with a caravan of reporters at the Nicaraguan border.
The ousted president's actions were described as "reckless" by Mrs Clinton.
Sensing US support for Mr Zelaya was slipping, the Honduran political establishment put its extensive Washington connections to work.
Members of Congress from both parties were besieged with high-level visits, in which the anti-Zelaya point of view was eloquently put. The president was legally removed from power because he violated the constitution, they argued.
They pointed to the thousands of pro-government supporters flooding on to the streets of Tegucigalpa. Proof, they said, that most Hondurans were glad their leftist president had been deposed.
Last weekend's elections provided a get-out clause for those who have had quite enough of this long, drawn-out political crisis in a country that was previously seen as a very low diplomatic priority.
It was a chance to identify a new leader, who could be welcomed into the international fold.
The Honduran government aimed to portray the vote as entirely untainted by the events surrounding Mr Zelaya's ousting. The candidates were selected before he was removed from office.
The US has recognised Porfirio Lobo's election victory
Within hours of polls closing, as it was emerging that conservative Porfirio Lobo was securing a big victory, the US State Department described the vote as having met "international standards for fairness and transparency".
Costa Rica, which has spent months diligently trying to mediate this conflict, has accepted the results. So have Colombia, Peru and Panama.
Mr Lobo is due to take office at the end of January, with interim leader Roberto Micheletti in charge until then.
But while the election and the result have won support, there are powerful doubters.
Brazil, Mexico, Argentina and Venezuela are among the countries that have been unwavering in their support for Manuel Zelaya.
They argue that not returning him to power will encourage coup plotters around the world.
But how do you reinstate a president, if the government, with popular backing, refuses to co-operate?
An alliance of world powers has failed to find an answer to that. So some are giving up.