Image caption There have been many protests across Greece against tough austerity measures

Greece is to get the latest tranche of bailout funds needed to keep the country going, eurozone finance ministers have said.

After weeks of tough talks, they agreed on Thursday to release 49.1bn euros ($57bn; £37bn) of funds.

The debt-ridden country will get 34.3bn euros "in the following days", with the rest to follow early next year.

Greece managed to complete a buyback of its debt this week, sealing the release of the funds.

It has been waiting since June for the money that is needed to help the government pay its debts and to support the country's banks.

"The Eurogroup is convinced that continued fiscal and structural reforms, building on the strong commitment demonstrated in the recent past and the wide range of reforms already carried out, will allow the Greek economy to return to a sustainable growth path," it said.

Long battle

At the last meeting of Greece's bailout lenders, it was agreed to grant the country a two-year delay in the speed of spending cuts, in order to take some of the pressure off Greece's heavily-depressed economy.

However, the extension inevitably meant the Greek government would be overspending for longer and would therefore run up bigger debts than previously anticipated.

This prompted an objection from the International Monetary Fund (IMF), which made clear that it could not lend money to a government whose debts it considered ultimately unlikely to be paid back.

The IMF's litmus test, laid down as a condition of Greece's latest bailout, is that the government's debts should fall to 124% of the country's annual economic output by 2020.

The buyback of Greek debt was intended to lower the country's debt load and make this possible. But it was dependent on the take-up from private investors.

On Wednesday, the country's debt management agency said the government had bought back 31.9bn euros of bonds at 33.8% of their face value. The discount was not as large as had been hoped, but the difference was not enough to scupper the disbursement of the bailout funds.

So far, the European Central Bank, IMF and the European Commission have pledged a total of 240bn euros in rescue loans, of which Greece has received about 150bn euros.

In return, Greece has had to impose several rounds of tough austerity measures, which have contributed to a severe and prolonged economic contraction.

According to projections from the European Union's statistics agency Eurostat, by the end of this year the Greek economy will have shrunk by a fifth since the financial crisis began in 2008.