LONDON — The International Monetary Fund and Pakistan reached a provisional agreement on Thursday on a $5.3 billion bailout package that aims to bolster Pakistan’s flagging economy and its low foreign exchange reserves.

The rescue package is expected to soothe Western fears about the state of Pakistan’s economy, which has slumped in recent years amid unrelenting Taliban violence and deeply rooted corruption that have shaken investor confidence. The IMF package also would provide a tangible lift for the newly elected prime minister, Nawaz Sharif, who has already become bogged down by a seemingly intractable energy crisis.

The IMF has an unhappy history with Pakistanis, some of whom are likely to see the package negatively.

The last government failed to meet the terms of the last IMF package six years ago, and the country is still struggling to repay billions of dollars of that debt.

Moreover, Sharif’s government is ideologically hostile toward international financial assistance, and campaigned before the election on a platform of economic autonomy. But, analysts say, his administration had little choice but to accept Thursday’s deal.

The $5.3 billion package will be used in part to service the existing IMF debt, but also to create confidence in the economy and alleviate the severe energy crisis, which has seen crippling electricity cuts across the country, even in the capital, Islamabad, in recent months.

“It was a necessary thing,” said Sakib Sherani, an economist who advised the last government. “Everyone’s been on tenterhooks about the balance of payments crisis, and a possible run on the rupee. At least this will provide some stability so the new government can work on implementing its own agenda.”