After months of painstaking negotiations, cash-strapped Pakistan has reached a new agreement with the International Monetary Fund (IMF), securing a US$6 billion bailout, officials said on Sunday.

It is the 22nd bailout the IMF has agreed to give Pakistan, which desperately needs it to stave off a looming balance-of-payments crisis while its economy teeters because of low growth, soaring inflation, and mounting debt.

“The program aims to support the authorities’ strategy for stronger and more balanced growth by reducing domestic and external imbalances, improving the business environment, strengthening institutions, increasing transparency, and protecting social spending,” said Ramirez Rigo, head of the IMF delegation, in a statement released late on Sunday.

According to Pakistan’s finance adviser Abdul Hafeez Shaikh, the country is set to receive $6 billion from the IMF in addition to between $2 billion and $3 billion from the World Bank and Asian Development Bank over the next three years.

“We have a $12 billion gap in our annual payments and we don’t have the capacity to pay them,” Shaikh said in a televised address as he announced the new agreement with the IMF.

Analysts have warned that any fresh IMF agreement would likely come with numerous restrictions that could undermine Prime Minister Imran Khan’s grand plan to build an Islamic welfare state, as the country is forced to curb its spending.

The IMF deal comes weeks after Shaikh – a former World Bank official who was Pakistan’s finance minister from 2010-2013 – was appointed as “adviser on finance” after finance minister Asad Umar resigned amid a wide-ranging cabinet reshuffle.

The abrupt resignation of Umar – one of Khan’s most powerful ministers – was particularly shocking because of his perceived role in overseeing the vital negotiations with the IMF over the long-delayed bailout.

The announcement comes as discontent is already growing over measures Khan’s government has taken to fend off the crisis, including devaluing the rupee by some 30% since January 2018, sending inflation to five-year highs.

A government report published on Friday also noted that Pakistan’s growth rate is set to hit an eight-year low, with the country’s GDP rate likely to sink to 3.3% against a projected target of 6.2%.

– with reporting by AFP