Euro zone finance ministers and the IMF announced on Monday night that they reached a deal on an urgently needed bailout for Greece.

They agreed to cut Greece’s debt by 40 billion euros ($51 billion; £32 billion) and to release the next tranche of bailout loans, worth some 44 billion euros, the BBC reported. That will reduce Greece's debt to 124 percent of its gross domestic product by 2020, down from its current rate of 144 percent of Greece's GDP.

The deal also cuts the interest rate on loans to Greece and returns 11 billion euros to Athens in profits from ECB purchases of Greek government bonds.

In a significant new pledge, the ministers committed themselves to take further steps to lower Greece's debt to "significantly below 110 percent" in 2022, Reuters reported. That is the most explicit recognition so far that some write-off of loans may be necessary from 2016, when Greece is forecast to reach a primary budget surplus.

"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.

The leader of the euro zone finance ministers' group, Jean-Claude Juncker, said the bailout did not just have financial implications, the BBC reported.

"This is not just about money. It is the promise of a better future for the Greek people and for the euro area as a whole."

Meanwhile, the European Union's commissioner for economic and monetary affairs, Olli Rehn, said it was crucial that a deal had finally been reached.

"For the euro zone, this was a real test of our credibility, of our ability to take decisions on the most challenging of issues. And it was a test that we simply could not afford to fail."

European Central Bank President Mario Draghi also hailed the pact, saying it would "strengthen confidence in Europe and in Greece."

The breakthrough came after 10 hours of talks in Brussels, the euro zone's third meeting in two weeks on Greece.

Greece has been waiting since June for its next tranche of bailout cash to help its heavily indebted economy stay afloat.

Juncker said the ministers would formally approve the release of a major aid installment to recapitalize Greece's failing banks and enable the government to pay wages, pensions and suppliers on Dec. 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.

The euro strengthened against the dollar after news of the deal was reported.