Euro zone governments threw Greece another 11th-hour credit lifeline on Thursday worth $9.5 billion and sketched new detail on possible debt relief as the IMF finally offered to help out after two years of hesitation.

The 8.5 billion euros of loans from the euro zone’s 18 other states, including Berlin which is wary of easing terms for Greece ahead of a German election in September, lets Athens avoid defaulting on bailout repayments next month and recognizes unpopular cuts and reforms the left-wing government has made.

“There is now light at the end of the tunnel,” Greece’s Euclid Tsakalotos told reporters after meeting fellow euro zone finance ministers and IMF chief Christine Lagarde in Luxembourg.

The accords gave enough clarity to investors on how Greece can manage its crushing debt burden that it should be able to borrow on the market again “in due course” after effectively relying on bailout support from other sovereigns since 2010.

A proposal by the French government under new President Emmanuel Macron to help bridge differences on debt relief will underpin further euro zone discussions, officials said. Macron wants to work with Germany to strengthen the 18-year-old common currency, which was nearly wrecked by the sovereign debt crisis.

German Finance Minister Wolfgang Schaeuble, whose insistence on austerity reforms to public finances in Athens have long made him a hate figure for many Greeks, said lawmakers in Berlin would review the deal on Friday to see if it deviated from a 2015 bailout enough to need new German parliamentary approval.

Euro zone bailout fund chief Klaus Regling said his European Stability Mechanism would disburse 7.7 billion euros in early July to cover 6.9 billion euros in maturing debt and 0.8 billion of arrears. A further 0.8 billion euros would be disbursed “after the summer”.

IMF JOINS IN

The International Monetary Fund would join the current bailout, Lagarde said, offering Athens a standby arrangement of less than $2 billion, the length of which will be tailored to match the end of the euro zone bailout in mid-2018.

But the Washington-based Fund, which Europeans value for its rigor but had fallen out with over its demands they forgive Athens some of its debt, will not disburse any of its money yet. It still wants the euro zone to offer sufficient extra detail on possible debt relief in 2018 to let the Fund calculate that it will be enough for Athens to sustain its debt in the long run.

The standby arrangement was a second best solution to a full debt deal, Lagarde said, but it would buy the euro zone, Greece and the IMF time to work out the details for next year.

A senior IMF official said they were still not satisfied the euro zone was ready to do enough on debt relief but had joined the bailout anyway as Greece risked being in difficulty again.

To accommodate the IMF’s need for more specifics on debt relief, the euro zone finance ministers said in a statement that in 2018 they would be ready to consider extending the maturities and grace periods of their loans to Greece by a range from zero to 15 years. The average maturity now is 30 years.

But they did not go any further than that and the IMF said it was not enough to calculate Greek debt sustainability.

Debt relief has been a hard sell in Germany, the biggest contributor to Greek bailouts over the years, though it is also unpopular in other countries, notably in poor Eastern Europe, where Greek welfare support seems generous to many.

Berlin also wants to retain leverage over Greece to make sure reforms remaining under the bailout are implemented.

But in a mark of relief among the European Union’s top leadership that the divisive crisis among member states seemed to be under control, European Council President Donald Tusk, who will chair a summit of EU leaders next week, tweeted: “Finally good news for Greece. It was well deserved.”

The euro zone has been reluctant to commit to concrete debt relief numbers now because it argues that if Greece does all that is required of it and keeps a high primary surplus – the budget before debt servicing costs – for decades, it may not need any debt relief at all.

But the IMF says euro zone assumptions on Greek economic growth and the country’s ability to keep a high primary surplus are unrealistic and that Athens clearly needs debt relief to win back investor confidence and return to market financing.

To bridge the wide differences in assumptions on Greek growth for the next decades, France proposed to link the size of the debt relief with Greek economic growth and euro zone ministers said they would work on that idea further.

They said in their statement that the exact mechanism of how to link debt relief to growth would be worked on as of 2018 by deputy finance ministers and treasury officials and be announced after the bailout ends, together with the whole debt deal.