FRANKFURT — As European finance ministers labored on a plan to shore up Spanish banks in recent days, the urgency of that mission was driven by events in a country at the other edge of the euro zone: Greece.


The Spanish banking rescue agreed to on Saturday will be expensive — costing up to €100 billion — but well within the means of a European emergency fund already established for just such purposes.


Far harder to calculate are the costs if, after Greek elections Sunday, the new government there reneges on the terms of the bailout Athens negotiated with its European lenders only a few months ago. That could lead to an unprecedented withdrawal from the euro zone, threatening the structural integrity of a currency union that has largely benefited more prosperous members like Germany.


“The stakes are exceptionally high,” Lucas Papademos, former interim prime minister of Greece, told a bankers’ group in Copenhagen on Friday, “because the decisions to be made at, and immediately after, the forthcoming elections will determine the country’s future for at least the next decade.”


Mr. Papademos, who is also a former vice president of the European Central Bank, said Greece’s departure from the euro zone would be catastrophic, pushing inflation in the country as high as 50 percent, putting extreme stress on Greek banks and reducing living standards.


And those problems would not be Greece’s alone. The big fear in Europe is contagion — an infection of financial panic that could spread far beyond Greece. Indeed, Spanish leaders have long said that Greek problems were contributors to the general market uncertainties that helped undermine Spanish banks.


The next task of European leaders is to show the rest of the world that they are making a credible effort to repair the flaws in the edifice of the euro zone that allowed the problems in one small country, Greece, to become a threat to the world economy.


“The way the currency union has been functioning is not sustainable,” Jens Weidmann, the president of the German Bundesbank, told the Welt am Sonntag newspaper. “A breakup of the currency union would bring extremely high costs and risks that no one can really predict,” he said.


Even if Greece does end up with a government willing to try living up to the terms of its €130 billion, or $163 billion, bailout deal by meeting its payments and attempting to narrow its large budget gap, there are strong doubts whether any new leadership in Athens would be able to fulfill those obligations. A lot of private money has already fled Greece, while its deeply depressed economy and dwindling tax revenues threaten to put the country ever deeper in the hole.


“Even in case of a new government, I doubt whether the institutional framework in Greece can guarantee the program,” said Jürgen Stark, a former member of the European Central Bank’s executive board. “Who has the competence to implement the program? That is the key point.”


Mr. Stark is among those who believe that the euro zone is strong enough to withstand Greece’s departure. “There will be contagion,” he said in a telephone interview. “But I think it can be managed. It will be costly in the short term. There will be benefits in the long term.”


Jitters about what Greek voters might do this Sunday may have helped soften the rhetoric coming from Germany, the euro zone’s paymaster, in recent days. Although Berlin has been Greece’s harshest economic critic, Germans awoke Thursday to see Angela Merkel, their chancellor, telling them on breakfast-time television that Europe needed a fiscal union — implying that some of their tax dollars might be needed to help the suffering Spaniards and Greeks.


“We need more Europe,” Ms. Merkel said on ARD television. “We do not only need a monetary union, but we also need a so-called fiscal union. This means that we also need a common budgetary policy and we also need a political union.”