Unfortunately for Greece and for Europe, we may now have to live with a third bailout program, in which Greece will receive a rescue package worth 86 billion euros (about $94 billion) in return for additional austerity measures. The new agreement will most likely drag Greece through three more years of a long-lasting, costly experiment that has so far failed miserably.

As of June, the eurozone countries, the European Central Bank and the International Monetary Fund had provided the Greek government and banking system with 344 billion euros ($375 billion) worth of public credit — nearly double Greece’s annual economic output, or about 31,000 euros ($33,000) for each Greek citizen.

One-third of the public credit that has flowed to Greece since 2008 has been used to bail out private creditors; one-third went to finance the Greek current account deficit (the excess of imports and net interest payments to foreigners over exports and transfer payments from abroad); and one-third vaporized by financing the capital flight of Greeks.

The public credit has delayed a Greek bankruptcy, but it has failed to revitalize the Greek economy. To compete, Greece needs a strong devaluation — a relative decline of its price level. Trying to lower prices and wages in absolute terms (for example, by slashing wages) would be very difficult, as it would bankrupt many debtors and tenants.

It would arguably be better to inflate prices in the rest of the eurozone, as the European Central Bank is trying to do through quantitative easing: purchasing large quantities of bonds to drive down the value of the euro. If the rest of the eurozone posts inflation rates of slightly less than 2 percent, as the E.C.B. hopes, Greece would be competitive after a decade or so, provided that its price level stays put. However, even such a mild form of an “internal devaluation” would be very arduous, as it would require precisely the kind of fiscal restraint that the Greeks rejected in the referendum.

What about the solution favored by leftists: more money for Greece? No doubt, enormous government spending would bring about a Keynesian stimulus and generate some modest internal growth. However, apart from the fact that this money would have to come from other countries’ taxpayers, this would be counterproductive, as it would prevent the necessary devaluation of an overpriced economy and keep wages and prices above the competitive level.

Take the case of Ireland. Like Greece, Ireland became too expensive, as interest rates fell sharply during the introduction of the euro. When the bubble burst, in late 2006, no fiscal rescue was available.

The Irish tightened their belts and underwent a drastic internal devaluation by cutting wages, which in turn led to lower prices for Irish goods both in absolute and relative terms. This made the Irish economy competitive again.

Granted, Ireland also received fiscal aid. But that came much later, toward the end of 2010, and when it came, the internal devaluation stopped almost immediately. Twelve of the 13 percentage points of the Irish decline in relative product prices came before that date. Of the eurozone countries hardest hit by the financial crisis, Ireland will be the only one this year to see its G.D.P. surpass its precrisis level.

Greece’s devaluation started five years after Ireland’s, and by now has reached 9 percent. Analysis by Goldman Sachs researchers suggests that product prices would have to decline by another 13 to 22 percentage points for Greece to be competitive. (Wages in neighboring Turkey, Bulgaria and Romania, the latter two being European Union members, are only one-third to one-fifth Greece’s level.)

The better alternative is a Grexit accompanied by debt relief, humanitarian aid for the purchase of essential imports and an option for eventual return to the euro. Greece could reintroduce the drachma as the only legal tender. All existing prices, wages, contracts and balance sheets, including internal and external debt, could be converted one-to-one into drachmas, which would immediately decline in value.

The devaluation would induce Greeks to buy domestic rather than imported products. Tourism would get a boost, and capital flight would be reversed. Rich Greeks would return with their money, buy real estate and renovate it, fueling a construction boom. As the trade deficit gradually turned into a surplus, creditors would get some of their money back.

Greece would have the option to return to the eurozone, at a new exchange rate, after carrying out institutional reforms — such as public recording of land purchases, functioning tax collection, accurate statistical reporting — and meeting the normal conditions for eurozone membership. It could take five or 10 years.

It is true that Grexit would make it clear that membership in the eurozone is not irrevocable and could expose member countries to speculative attacks. But this is not very likely, as the markets’ calm reaction to Greece’s capital controls and the “no” vote in the referendum showed. More important, it would lead other countries to adopt more prudent financing and steer clear of the debt trap that caused the bubble in the first place.

Until Europe is turned into a federal state — as it should become, at some point — it will not have a currency like the dollar. Until then, what is needed is a “breathing” currency union, with orderly entry and exit options, coupled with an insolvency rule for member states. This would be a better compromise between the goals of avoiding speculative attacks and excessive debt accumulation than the current promise of eternal membership.