European Union leaders pledged support for Greece on Thursday, vowing to keep the debt-wracked country in the eurozone as officials prepared behind the scenes for a possible doomsday scenario of exit.
After a growth-oriented EU summit dominated by fears of a "Grexit" that went into the early hours of the morning, EU president Herman Van Rompuy told journalists: "We want Greece to remain in the euro area while respecting its commitments."
The EU chief hailed the "significant efforts already made by the Greek citizens" but appealed to Athens to continue to implement reforms that he said were the "best guarantee for a more prosperous future in the euro area".
European Commission President Jose Manuel Barroso summed up the leaders' view by saying: "The message that we send today is clear: we will stand by Greece while Greece stands by its commitments."
Nevertheless, diplomats said on the sidelines of the summit that officials had been tasked to make contingency plans in the case of Greece exiting the eurozone, sending European stocks and the euro sharply down on the markets.
A diplomat told AFP that officials from the other 16 eurozone member states were instructed this week to "reflect" on what an exit would mean for their economies.
This was not a political message to Greece, insisted the diplomat, but was a "normal" thing to do.
"It does not mean that we think the situation will get that far," he said, adding that "you would have said we were dreaming" otherwise.
"Treasury officials were already scratching their heads a year ago looking at different scenarios that could unfold," said another diplomat.
"Frankly, it would be dereliction of duty if they hadn't done this," he said.
In Athens, a government statement said the finance ministry "categorically denies" such plans.
And Greece's caretaker leader Panayotis Pikrammenos said that German Chancellor Angela Merkel was "surprised and upset" about the issue of Greece's exit from the eurozone being raised.
For his part, French President Francois Hollande said: "I can't say that there has not been work done" on simulating a Greek exit.
"But if I started to talk publicly about the hypothesis of Greece leaving, that would mean sending a signal to Greece and to the markets.
"I prefer to address the Greeks and say: France and Europe want you to stay in the eurozone," the president said.
Greece's election in June is shaping up to be effectively a referendum on whether the country stays in the euro, as parties opposed to austerity measures needed for future bailouts gain significantly in the polls.
The radical leftist Syriza party, which wants to tear up Greece's unpopular rescue deal with the European Union and the IMF, came second on May 6 and is expected to emerge in a strong position in the next ballot.
European leaders have warned that if the next government reneges on promised reforms Greece cannot hope to continue drawing international loans, which would likely lead to its exiting the eurozone.
"There is a democratic process taking place in Greece. Of course, we respect the democratic process. Let's wait for the people of Greece to have their say on June 17," said Barroso.
Van Rompuy said that after the elections, EU leaders expected the new Greek government to choose the path of reform and staying in the euro.
Merkel, who as leader of Europe's top economy holds the purse strings for any future bailouts, said the EU was sending a "positive message" to Greece but also warned that reform promises must be kept.
Earlier Wednesday, former Greek prime minister Lucas Papademos had sent markets tumbling after warning of the "catastrophic" economic consequences of a Greek exit, that some analysts have put at half a trillion euros.