By Jan Strupczewski and Annika Breidthardt
BRUSSELS (Reuters) - Euro zone finance ministers and the International Monetary Fund clinched agreement on reducing Greece's debt on Monday in a breakthrough to release urgently needed loans to keep the near-bankrupt economy afloat.
After 12 hours of talks at their third meeting in as many weeks, Greece's international lenders agreed on a package of measures to reduce Greek debt by 40 billion euros, cutting it to 124 percent of gross domestic product by 2020.
In a significant new pledge, ministers committed to taking further steps to lower Greece's debt to "significantly below 110 percent" in 2022 -- the most explicit recognition so far that some write-off of loans may be necessary from 2016, the point when Greece is forecast to reach a primary budget surplus.
To reduce the debt pile, they agreed to cut the interest rate on official loans, extend their maturity by 15 years to 30 years, and grant Athens a 10-year interest repayment deferral.
"When Greece has achieved, or is about to achieve, a primary surplus and fulfilled all of its conditions, we will, if need be, consider further measures for the reduction of the total debt," German Finance Minister Wolfgang Schaeuble said.
Eurogroup Chairman Jean-Claude Juncker said ministers would formally approve the release of a major aid installment needed to recapitalize Greece's teetering banks and enable the government to pay wages, pensions and suppliers on December 13.
Greece will receive up to 43.7 billion euros in stages as it fulfills the conditions. The December installment will comprise 23.8 billion for banks and 10.6 billion in budget assistance.
The IMF's share, less than a third of the total, will only be paid out once a buy-back of Greek debt has occurred in the coming weeks, but IMF Managing Director Christine Lagarde said the Fund had no intention of pulling out of the program.
They promised to hand back 11 billion euros in profits accruing to their national central banks from European Central Bank purchases of discounted Greek government bonds in the secondary market.
They also agreed to finance Greece to buy back its own bonds from private investors at what officials said was a target cost of around 35 cents in the euro.
European Central Bank President Mario Draghi said on leaving the talks: "I very much welcome the decisions taken by the ministers of finance. They will certainly reduce the uncertainty and strengthen confidence in Europe and in Greece."
Greek Prime Minister Antonis Samaras welcomed the deal.
"Everything went well," he told reporters outside his mansion at about 3 a.m. in the morning.
"Tomorrow, a new day starts for all Greeks."
However, the biggest opposition party, Syriza, dismissed the deal and said it fell short of what was needed to make the country's debt sustainable.
The euro strengthened against the dollar after news of the deal and commodities and Asian shares also rose.
Greece, where the euro zone's debt crisis erupted in late 2009, is the currency area's most heavily indebted country, despite a big "haircut" this year on privately-held bonds. Its economy has shrunk by nearly 25 percent in five years.
Negotiations had been stalled over how Greece's debt, forecast to peak at 190-200 percent of GDP in the coming two years, could be cut to a more sustainable 120 percent by 2020.
The agreed figure fell slightly short of that goal, and the IMF was still insisting that euro zone ministers should make a firm commitment to further steps to reduce the debt stock if Athens implements its adjustment program faithfully.
The key question remains whether Greek debt can become sustainable without euro zone governments having to write off some of the loans they have made to Athens.
Germany and its northern European allies have hitherto rejected any idea of forgiving official loans to Athens, but EU officials believe that line may soften after next year's German general election.
DEBT RELIEF "NOT ON TABLE"
Schaeuble told reporters earlier that debt forgiveness was legally impossible, not just for Germany but for other euro zone countries, if it was linked to a new guarantee of loans.
"You cannot guarantee something if you're cutting debt at the same time," he said. That did not preclude possible debt relief at a later stage if Greece completed its adjustment program and no longer needs new loans.
At Germany's insistence, earmarked revenue and aid payments will go into a strengthened "segregated account" to ensure that Greece services its debts.
A source familiar with IMF thinking said a loan write-off once Greece has fulfilled its adjustment program would be the simplest way to make its debt viable, but other methods such as forgoing interest payments, or lending at below market rates and extending maturities could all help.
The German banking association (BDB) said a fresh "haircut" or forced reduction in the value of Greek sovereign debt, must only happen as a last resort.
The ministers agreed to reduce interest on already extended bilateral loans from the current 150 basis points above financing costs to 50 bps.
No figures were announced for the debt buy-back in an effort to avoid triggering a rise in market prices in anticipation of a buyer. But before the meetings, officials had spoken of a 10 billion euro buy-back, that would achieve a net reduction of about 20 billion euros in the debt stock.
German central bank governor Jens Weidmann has suggested that Greece could "earn" a reduction in debt it owes to euro zone governments in a few years if it diligently implements all the agreed reforms. The European Commission backs that view.
An opinion poll published on Monday showed the Syriza party with a four-percent lead over the Conservatives who won election in June, adding to uncertainty over the future of reforms.
(Additional reporting by Robert-Jan Bartunek, Ethan Bilby, Luke Baker in Brussels, Reinhardt Becker in Berlin; Writing by Paul Taylor; Editing by Luke Baker and Anna Willard)