ISLAMABAD (AP) — Pakistan has negotiated a $6 billion assistance package of loans and deferred payments from Saudi Arabia in hopes of resuscitating its flagging economy, struggling under the weight of a whopping $18 billion deficit.

Analysts say the Saudi infusion will allow Islamabad to breathe a little easier as it seeks a critical loan from the International Monetary Fund.

The deal was signed Tuesday by Pakistan’s Finance Minister Asad Umar and his Saudi counterpart, Muhammad Abdullah Al-Jadaan, on the sidelines of an international investment forum underway in Riyadh.

It came as Pakistan’s new Prime Minister Imran Khan attended the high-profile conference, despite calls from Pakistani human rights activists to boycott the venue in protest of the killing of journalist Jamal Khashoggi in the Saudi Consulate in Istanbul — a slaying that has shocked the international community.

Many business executives, officials and others have pulled out of the gathering, known as the Future Investment Initiative Conference, which was the brainchild of Saudi Crown Prince Mohammed bin Salman and which runs through Thursday.

Khan, who took power following general elections in July, inherited an economy in shambles, with foreign exchange reserves barely sufficient to cover a month’s worth of the country’s import bills.

Local news organizations quoted Khan as saying that Pakistan could not afford to boycott the conference, although he did denounce the killing of Khashoggi. After Saudi Arabia, Khan was to visit the United Arab Emirates and Malaysia before returning to Pakistan.

The desperately needed Saudi financial infusion provides Pakistan with an immediate $3 billion to bolster its foreign exchange reserves, according to a foreign ministry statement. Pakistan is to return the $3 billion after one year, but the terms are apparently negotiable.

Pakistan is also to receive $3 billion in oil imports on a buy-now-pay-later basis under the Saudi deal. Currently, Pakistan imports more than 1 million barrels of Saudi oil a day at an annual cost of $3 billion.

The assistance package will put Pakistan in a better bargaining position going into negotiations with the IMF, said Tariq Yousuf Khan, an economics professor in the southern port city of Karachi.

Pakistan is seeking an $8 billion to $11 billion IMF bailout package.

“Now Pakistan is in a better position to talk to IMF negotiators and perhaps negotiate more favorable conditions,” the professor said. An IMF delegation is expected in Pakistan next month.

Pakistan has long standing, deep ties with Saudi Arabia but often finds itself walking a tightrope between Riyadh and Tehran. It has also offered to act as a mediator to reduce hostilities between the Sunni and the Shiite power. Like Saudi Arabia, Pakistan is a majority Sunni nation with a Shiite minority.

Analysts have often accused both Iran and Saudi Arabia of waging a proxy war in Pakistan where sectarian violence has often been deadly. Experts say Sunni and Shiite extremists in Pakistan are funded from Iran and Saudi Arabia.

___

Associated Press Writer Kathy Gannon in Kabul, Afghanistan, contributed to this report.