THE deep uncertainty over what will happen next in Greece unnerved financial markets. On May 7th the euro touched its lowest value against the dollar since January while in Athens the stockmarket fell by 7% and bank stocks by 13%. Greek bonds also took a hit, with the yield on the ten-year bond rising to 22.9% (from 20.5% at the end of April). Investors piled into the havens of German government bonds and American Treasuries. The Dow Jones Euro Stoxx 50 fell to its lowest level so far in 2012.

On the same day Angela Merkel, the German chancellor, was swift to insist that there could be no backtracking on the commitments Greece made at the time of its second bail-out earlier this year. By the end of June a Greek government is supposed to specify a further package of reforms and spending cuts, worth 5.5% of GDP; these are to be carried out in two instalments, the first in 2013, the second in 2014. But that timetable now looks more or less impossible, even if a government can be found that wants to stick to the bail-out's conditions. Relations between the country and its creditors may sour to such a point that a Greek exit from the euro—a “grexit”, as it is coming to be known—becomes inevitable. This need not be a self-fulfilling prophecy. But the more real it comes to seem, the more corrosive its effects on confidence, which adds further to the risks.

Even before an exit Greece's banks could collapse if the steady withdrawal of deposits—they are 30% below their peak, according to Credit Suisse—were to develop into an outright run. After an exit debts to foreign creditors would soar as the new drachma fell, leading to further defaults. On strict legal grounds, Greece could find itself cast out of the European Union as well as the euro area, at risk of losing access to the single market.

But the panic would not be confined to Greece (which made up just 2.3% of the euro zone by GDP in 2011). Depositors in other vulnerable economies could take fright and try to withdraw their funds from their banking systems. Even if the European Central Bank (ECB) fought this with massive liquidity support, the crisis would shake already frail banks, especially in Spain (see article).

A departure might not be quite as catastrophic for banks elsewhere in Europe as once it would have been. The bail-out deal agreed in February meant that private holders of Greek government bonds “voluntarily” had to exchange their holdings of bonds for new ones worth a fraction of the old. Seeing this coming, many banks had already written down the debt. That explains much of the €8 billion ($10 billion) in Greece-related losses that hit French banks last year, according to analysts at Credit Suisse.

Banks have more or less called a halt to new lending to Greek institutions, companies and banks. By the end of 2011 foreign banks' exposure to the Greek public sector had fallen to about $23 billion from $64 billion in September 2010. Cross-border loans to Greek firms and households had also fallen, from $86 billion to $69 billion. But that is still a lot.

Banks have found it difficult to cut lending any faster, partly because some loans are not due to mature for years, so they have sought other ways of reducing the potential losses that would follow if Greece adopts a new currency. One strategy is to gather Greek deposits to match the value of loans outstanding. Their thinking is that if the money they are owed is worth less, then so too should be the money they have promised to repay. There are limits to this approach, since deposits are scarce in Greece. But Greece is not the only place people are worried about. Banks are also trying to match loans to deposits in vulnerable countries such as Spain and Portugal. Among the tools that they have been able to use are the ECB's Longer Term Refinancing Operations, which have allowed banks to turn eligible collateral into cash on a grand scale. With so much time to prepare for the worst, many senior international bankers think that they may now be able to cope with the fallout of a Greek departure—which they see as highly likely. “It is still a taboo subject for open discussion with the regulator,” says the boss of one large European bank. “But they know we have a plan C and are doing all the things you would expect us to be doing [to prepare].” Bond yields will jump in any country that might conceivably leave the euro once such an exit has actually happened, with the rise proportional to the risk. Bad, then, for Spain and Italy. Worse for Ireland and Portugal, which have already needed bail-outs. Last year elections in both countries produced reform-minded governments, but the economic pain they are already undergoing is intense. A referendum on the German-inspired “fiscal compact”, which will insert public-debt brakes into national laws, is due in Ireland on May 31st and many Irish may be tempted to use the occasion to vent their discontent and add to the anti-austerity movement in Europe. An Irish rejection would not prevent the treaty coming into effect, but it would relieve the Irish of any obligations under it, and mean that they would not be bailed out in future.

Explore our interactive guide to Europe's troubled economies

The Irish and Portuguese governments are keen to distance themselves from Greece. The Irish can point to the fact that their benchmark bond yields, though still high (at 7% on May 8th), are much lower than Greece's (23.5%) or Portugal's (11.4%). Portugal, for its part, has won plaudits from the “troika”—the European Commission, the ECB and the IMF—for its determination to make policy reforms. They see the broad national consensus backing the programme as a crucial asset. Yet both economies remain fragile.

This distancing is reasonable: Greece's fiscal and economic plight is undoubtedly the most extreme. The awkward truth that European leaders failed to acknowledge in May 2010 is that the Greek state was broke when it received its first bail-out. Even after a default that more than halved the face value of private bondholdings (and reduced their net present value by three-quarters), the IMF expects Greece's government debt still to be 161% of GDP in 2013 (see chart). That will be much higher than in Ireland and Portugal where, assuming current plans are kept to, debt is forecast to peak next year at 118% and 115% of GDP respectively.

Domino dancing

With its debt burden so great, even though it is paying low rates of interest on both its bail-out loans and its restructured private debt, Greece's path is harder. It has already made an extraordinary fiscal effort from a desperate starting-point: its primary budget balance (ie, before interest payments) improved by 8% of GDP between 2009 and 2011. But it still has to do almost as much again to make the further required gain of nearly 7% of GDP by 2014. That would give it a primary budget surplus of 4.5% of GDP—a surplus that would need to be sustained all the way to 2020 just to bring its debt down to the levels at which Irish and Portuguese debt is expected to peak in 2013.

The fiscal woes of the other two bailed-out countries are less intractable. Ireland's ill-judged guarantee of bank debts in 2008 made matters much worse, but it started off with a far better debt position, and Portugal's, though more worrying, was not too bad. Debt-sustainability analysis by the IMF suggests that they both need to aim for a primary surplus of around 3% of GDP. After an underlying retrenchment of about 4%, Portugal is nearly half way towards reaching that objective. Ireland, often pointed to as a model pupil, has to do more because its primary deficit of 6.7% of GDP last year was considerably higher than Greece's and Portugal's.

That will be painful for the Irish, but they can draw consolation from a brighter outlook for recovery. After a grim slide between 2007 and 2010, the economy picked up modestly last year, buoyed by exports, and is expected to grow this year—though by only a meagre 0.5%. That will leave its GDP 9% lower than in 2007 (see chart). Portugal will have a tougher year in 2012, with output falling by 3.3%, following a contraction of 1.5% last year; but owing to a better earlier performance that will make its cumulative decline since 2007 a less painful 6%. Greece has fared far worse, with GDP collapsing by almost 7% last year and expected to fall by a further 4.7% this year, bringing its cumulative slump since 2007 to 17%. Ireland has some trump cards which the other two economies lack. In particular it remains an attractive production base for high-tech international firms, especially in information-technology and pharmaceutical companies, lured by a skilled workforce and a low corporate-tax rate; earlier this month SAP, a software firm, announced plans to create 250 new jobs at its facilities in Dublin and Galway. And thanks to a flexible labour market and an open economy it has already clawed back a good deal of the cost competitiveness it lost during the boom years. By contrast domestic costs have adjusted much more sluggishly in Portugal and Greece, as their trading performance reveals. Whereas Ireland's current account was just in surplus last year, Portugal ran a deficit of 6.4% of GDP. Greece's was still higher, at 9.7%, an astonishing level for the depths of recession. One reason is that exporters have been held back by an inability to get financing from banks which themselves have been facing a funding crisis. Within the single-currency area competitiveness has to be regained the hard way—by pushing down domestic costs or increasing productivity—rather than the easier-to-swallow medicine of devaluation. That is why “structural” reforms remain essential, especially in Greece and Portugal, since they confront vested interests in both countries that have kept labour markets inflexible (favouring people already in work against new entrants) and cosseted product markets, particularly where these are not exposed to foreign competition. After frustratingly long delays some of the necessary changes have been made in Greece, although that progress now looks in jeopardy as the political drive wavers. Portugal has got off to a better start, but still has a lot of work to do.

Greece is now caught in a vicious circle between political uncertainty and economic contraction. The renewed doubts over its commitment to meeting the conditions for its bail-out will impair investment and frighten households, exacerbating the economic misery that voters are rejecting, and perhaps making it less likely that they will elect a government that can manage to keep Greece in the euro area.

Although Portugal and Ireland might well have what it takes to stay in the system as it stands, the seismic shock of a Greek exit could ruin that. The European creditor nations led by Germany would do their utmost to safeguard Portugal and Ireland, not least to contain the after-shocks. But that might not be enough.

Even if a Greek solution can be found, Ireland and Portugal are still weak. Their ability to regain access to market financing in 2013 as planned (with Ireland dipping its toes into the water later this year) is far from sure. The market judgment, expressed through bond yields, is that Portugal looks the more vulnerable. But Ireland's debilitating banking crisis still holds it back. Neither economy is in any state at all to weather a grexit.