BRUSSELS - The countries that use the euro pulled Greece back from an imminent and potentially catatrophic default on Tuesday, when they finally stitched together a 130 billion euro ($170 billion) rescue they hope will also provide a lifeline to their common currency.
But the patchwork of measures - including the implementation of austerity measures in Greece and approval by skeptical German and Dutch parliaments - required to give the rescue even a chance of success means it's unlikely to be the end of the continent's debt crisis.
European markets edged lower, having enjoyed solid gains in the run-up to the meeting on expectations a deal would be secured, while the euro rose 0.2 percent.
The finance ministers from Greece and the other 16 countries that use the euro wrangled until the early morning hours over the details of the rescue, squeezing last-minute concessions out of private holders of Greek debt.
The eurozone and the International Monetary Fund, which will be providing the money for the new bailout, hope the new program will eventually put Greece back into a position where it can survive without external support and secure its place in the euro currency union.
The accord, which had been months in the making, seeks to reduce Greece's massive debts on all fronts, with both private and official creditors going beyond what they had said was possible in the past.
On top of the new rescue loans, Athens will also ask banks and other investment funds to forgive it some 107 billion euro ($142 billion) in debt, while the European Central Bank and national central banks in the eurozone will forgo profits on their holdings.
The deal "closes the door to an uncontrolled default that would be chaos for Greece and Greek people," said European Commission President Jose Manuel Barroso.
But despite those unprecedented efforts, it was clear that Greece, which kicked off Europe's debt crisis two years ago, was at the very best starting on a long and painful road to recovery. At the worst, the new program would push the country even deeper into recession and see it default on its debts further down the line.
"It's not an easy (program), it's an ambitious one," said Christine Lagarde, the head of the IMF, adding that there were significant risks that Greece's economy could not grow as much as hoped.
Including Greece's first bailout worth 110 billion euro ($146 billion), the new deal means every Greek man, woman and child will owe the eurozone and the IMF about 22,000 euro ($29,000).
In Athens, the reaction to the news was a mixture of relief the country has avoided financial catastrophe and fear of a dark future.
"I don't see (the agreement) with any joy because again we're being burdened with loans, loans, loans, with no end in sight," architect Valia Rokou said in the Greek capital.
The eurozone and Greece had been under pressure to reach an accord quickly to prevent Athens from defaulting on a 14.5 billion euro ($19.2 billion) bond payment on March 20. The fear is that an uncontrolled bankruptcy could unleash market panic across the rest of the continent, further unsettling other struggling countries like Ireland, Portugal or the much bigger Italy or Spain.
Despite the promise of new rescue loans, the other 16 euro countries made clear that their trust in Greece is running low. Before Athens will see any new funds, it has to implement a range of promised cuts and reforms.
Greece will also have to pass within the next two months a new law that gives paying off the debt legal priority over funding government services. In the meantime, Athens has to set up an escrow account, managed separately from its main budget, that will at all times have to contain enough money to service its debts for the coming three months.
These requirements, together with tighter on-the-ground monitoring, are an unprecedented intrusion into the fiscal affairs of a sovereign state in Europe and could eventually see Greece being forced to pay interest on its debt before compensating teachers, doctors and other state employees.
Greek politicians nevertheless greeted the package as a turning point for their battered country.
"It's no exaggeration to say that today is a historic day for the Greek economy," said Greek Premier Lucas Papademos, who had rushed to the finance ministers' meeting to lend weight to his country's pleas for help.
The deal is expected to bring Greece's debt down to 120.5 percent of gross domestic product by 2020 - around the maximum the eurozone and IMF consider sustainable. At the moment, the debt stands at more than 160 percent of GDP.
But as Greece's economy faces a fifth year of recession, confidence that it can reach the 120 percent target in 2020 was fading quickly.
"One can discuss at length the assumptions on which this (target) is based," German Finance Minister Wolfgang Schaeuble said after the meeting. "Because of that we decided to at least be sincere about the figures."
Ahead of the meeting, Greece's international creditors - the EU, the ECB and the IMF - warned that without new measures the debt would still remain close to 129 percent by the end of the decade even under its optimistic scenario. That shortfall persisted even though Athens had faced down violent protests to pass a massive new round of cuts and reforms through Parliament just last week.
So to reach a successful outcome, the finance ministers had to fight on many fronts.
The representatives of private holders of Greek debt had to agree to steeper losses than they had earlier said was possible in a voluntary debt relief. The Institute of International Finance said the bond swap could see Greece's debt reduced by 107 billion euro immediately. On top of that, investors will be asked to give Athens 30 years to repay them, compared with just under 7 years. Average interest rates would fall to 3.65 percent from around 4.8 percent.
Jean Lemierre, who was co-heading the talks for the IIF, said overall losses for private bondholders would be above 70 percent when accounting for the new bonds' longer repayment period and lower interest rate.
Private investors weren't the only ones having to give ground.
The eurozone countries will reduce the interest that Greece has to pay for its first package of bailout loans to 1.5 percentage points over market rates from between 2 percentage points to 3 percentage points currently, cutting both its debt load and limiting the need for new rescue loans.
At the same time, the European Central Bank and the national central banks in the countries that use the euro will forego profits on their Greek debt holdings, again reducing the costs for Greece.
"It's a very good accord in the sense that it is equitably divvied up," said French Finance Minister Francois Baroin. "The Greeks have made their efforts. The Europeans are playing their supporting role, in their role as creditors ... And the private sector part goes beyond" what could be expected.
But several hurdles remain before Greece will see any of the money or other benefits of the new program.
Apart from the implementation of more than 30 different savings and reform measures by Greece, the new bailout has to be debated by parliaments in several member states, including Germany, the Netherlands and Finland.
The IMF also still has to decide how much of the 130 billion euro bill it is willing to stump up. Going into the meeting, the Washington-based fund had indicated its contribution will be lower than the one-third of the total it has provided in previous bailouts.
IMF chief Lagarde said the fund's board would decide on its contribution in the second week of March.
"In doing so it will have in mind the overall program, but also additional matters such as the proper setting up of a decent firewall," Lagarde said with reference to Europe's current and future bailout funds.
At the moment, the overall ceiling for eurozone rescue loans has been set at 500 billion euro ($663 billion), much of which has already been committed to Ireland, Portugal and now Greece. Euro leaders will decide at their summit in early March whether that ceiling should be increased.
On top of that, it will also take some time to see how many private creditors will participate in the debt relief and how many will have to be forced to sign up through new legal clauses. The representatives of the private bondholders said they were confident that investors would find the deal attractive, but some analysts fear that imposing losses on even some bondholders may destabilize markets.
Perhaps most crucially, however, may be new national elections in Greece scheduled for April, which could upend the political landscape in the country. The leaders of the two main parties have committed to the cuts and reform program, but anti-bailout parties have been gaining in the polls.