Islamabad (CNN) Pakistan's Prime Minister Imran Khan has secured $6 billion in financial support from Saudi Arabia as Riyadh reels from international outrage over the murder of journalist Jamal Khashoggi.

Islamabad announced the deal Tuesday night after Khan attended a Saudi investment conference, the so-called "Davos in the desert," even as several other leaders declined invitations over Khashoggi's death at the country's consulate in Istanbul on October 2.

Riyadh says insider-turned-critic Khashoggi died in a fistfight with Saudi officials, while Turkey says he was killed in a premeditated murder.

After Khashoggi's disappearance, business leaders and government officials pulled out of the Future Investment Initiative (FII) conference, but Pakistan is facing tough economic realities that Khan, who took office in August, can't ignore.

Before this week's conference, Khan said that Pakistan, which is facing an acute balance of payments crisis, was "desperate" for Saudi loans to shore up the economy.

"Unless we get loans from friendly countries or the IMF, we actually won't have in another two or three months enough foreign exchange to service our debts or to pay for our imports. So we're desperate at the moment," Khan reportedly told Middle East Eye.

JUST WATCHED Trump accuses Saudis of 'the worst cover-up ever' Replay More Videos ... MUST WATCH Trump accuses Saudis of 'the worst cover-up ever' 04:36

'We're desperate'

In the deal agreed Tuesday, Saudi Arabia will give Islamabad $3 billion in foreign currency support for a year and a further loan worth up to $3 billion in deferred payments for oil imports.

"This arrangement will be in place for three years, which will be reviewed thereafter," Pakistan's foreign ministry said in a statement.

The deal comes after a previous visit by Khan to Riyadh, his first overseas trip since taking office in July, failed to produce significant results.

Pakistan's Finance Minister Asad Umar recently said the country may need more than $12 billion to plug its finances as the current-account deficit widens and foreign-currency reserves plummet.

Pakistan has devalued its currency multiple times since December and reserves have plunged to $8.1 billion, according to Bloomberg

This month Umar requested talks with the IMF, to discuss Pakistan's second bailout in five years, though he said it would be the country's last.

Plaudits and criticism

Khan faced domestic criticism for attending the conference but Riyadh's pledge of financial support, which was larger than analysts expected, has also won him plaudits.

Dawn newspaper columnist Ayesha Ijaz Khan questioned whether Saudi Arabia will expect Khan to side with its version of events in the Khashoggi case over that of Turkey, another key ally of Islamabad.

"These are important questions to ponder as there is no free lunch in this world," she said. Other critics asked whether the Sunni kingdom now expects Pakistani support for its controversial war in Yemen against Shia Houthi groups.

Islamabad has so far resisted such a move, fearing it would create trouble with neighboring Shia-dominated Iran, which backs the Houthi, and worsen Sunni-Shia tensions within Pakistan.

However, some analysts said the benefits of the deal outweigh the criticism it has attracted.

"For Islamabad, the optics of seeking financial support from a Saudi regime with fresh blood on its hands and a tarnished image are poor, to say the least," Michael Kugelman, South Asia expert at the US-based Wilson Center, told CNN.

But he added that in terms of Pakistan's interests, securing the assistance "qualifies as an unvarnished success."

"Islamabad has secured badly needed cash that few states were willing to provide," he said.

Mosharraf Zaidi, a columnist and political analyst said that the deal must be seen in the context of Pakistan having to delicately manage complex regional dynamics "and an insatiably hungry youth-based economy."

"This is a fine start. But this only buys oxygen," he added. "The real test is reform."

Analysts say the Saudi loans will also reduce the size of the bailout package needed from the IMF and strengthen Pakistan's negotiating position with the fund.

US President Donald Trump's administration has signaled major reservations about the IMF granting Pakistan another bailout as Islamabad assumes billions of dollars in debt for the China-Pakistan Economic Corridor (CPEC), a multi-billion dollar series of Chinese funded infrastructure projects.

"(Pakistan) can also now request a somewhat lesser sum from the IMF, which in turn will reduce some of the political risks of venturing to the Fund, a move that never plays well within the court of Pakistani opinion," said Kugelman.