ATHENS, Greece (AP) – Greek government officials said Tuesday they have reached an agreement with its creditors on the terms to restart bailout loan payouts, following months of tough negotiations.

The terms include another round of pension cuts in 2019 and a commitment to maintain a high primary budget surplus after the current rescue program ends next year.

Prime Minister Alexis Tsipras’ left-wing government is set to approve the new cuts in parliament by mid-May, so that Eurozone finance ministers could unfreeze bailout funds at a scheduled meeting on May 22.

Protesters chant slogans in front of Riot police cordon outside a hotel where bailout inspectors were due to resume talks with the Greek government in Athens, on Monday, May 1, 2017. Several thousand protesters have gathered outside Greece’s parliament as May Day rallies kicked off around the country, and unions braced for more austerity measures imposed by bailout lenders. (AP Photo/Thanassis Stavrakis)

Tsipras’ governing coalition has a majority in parliament of just three seats.

Greece has been surviving on bailout loans since 2010 in return for harsh spending cuts and tax increases that have put nearly a quarter of the workforce out of work and seen more than a third of the population living in poverty or at risk of poverty.

“We have said many times … that this is a painful compromise,” Interior Minister Panos Skourletis told state-run ERT television.

Tsipras’ governing Syriza party is trailing badly behind rival conservatives in the polls, and he has insisted it will not seek elections until his term ends in 2019.

The agreement was reached after a nightlong session of talks at an Athens hotel. Government officials said lenders dropped their demands to abolish a long list of employment rights and also agreed to the expansion of benefit schemes for jobless and low-income families.

Hours before the deal, protesters had gathered at the entrance of the hotel during large May Day rallies in the capital, but riot police blocked them from entering the building.

Tsipras’ government – which rose to power on an anti-bailout platform – had initially aimed at finalizing the current round of negotiations with creditors last December.

The delay has threatened hopes to return to growth after years of recession and stagnation fueled by austerity and a reversal of prior chronic state overspending.

Greece faces a spike in bailout loan repayments in July, and needed to unlock the additional funds to avoid the threat of bankruptcy.

Riot police officers secure the entrance of a hotel where bailout inspectors were due to resume talks with the Greek government in Athens, on Monday, May 1, 2017. Several thousand protesters have gathered outside Greece’s parliament as May Day rallies kicked off around the country, and unions braced for more austerity measures imposed by bailout lenders. (AP Photo/Thanassis Stavrakis)