ISLAMABAD, Pakistan — Fighter jets escorted his plane through Pakistani airspace, and a 21-gun salute greeted him upon landing Sunday evening. The capital was blanketed with enormous posters of the royal guest, grinning beneath his familiar red and white-checked headscarf. Banners welcomed him to his “second home.”

In the West, Saudi Crown Prince Mohammed bin Salman has lost much of the luster he gained after becoming heir to the throne in 2017, pledging to increase freedoms for women and enact other reforms. His rule became increasingly seen as repressive, especially after the death of dissident Saudi writer Jamal Khashoggi, who U.S. and Turkish officials say was killed and dismembered inside the Saudi consulate in Istanbul in October.

But in Pakistan, where Mohammed arrived Sunday for a 20-hour visit crammed with ceremonies and meetings, he is viewed as an answer to the nation’s prayers: a powerful benefactor who officials hope will deliver a generous package of loans and investment deals to help revive Pakistan’s struggling economy and reverse its steep slide into insolvency and debt.

The red carpet being rolled out for Mohammed, the first Saudi leader to visit Pakistan in 15 years, has surpassed all foreign state visits in recent memory. With high security planned for the capital and nearby garrison city of Rawalpindi, several luxury hotels emptied to accommodate his large entourage, and breathless news coverage advancing his trip, nothing has been left to chance.

The crown prince’s visit “heralds a new era in Pak-Saudi Arabia brotherly relations,” Ehsan ul Haq, an influential retired Pakistani army general, wrote in one of many welcoming essays in Pakistani newspapers. It will send “a robust message of synchronized strategic vision” and serve as a “stern reminder to those who may bear ill will to our mutual interests.” 

On Saturday, the entire front page of the Nation newspaper was a gold-framed color portrait of Mohammed. An eight-page daily edition of Arab News, a paper published in Riyadh, Saudi Arabia, was inserted inside every copy. Its top headline called Iran a “leading state sponsor of terror,” a quote from Vice President Pence at a recent conference — and a message to Mohammed’s hosts that the Trump administration is Saudi Arabia’s friend and Iran’s enemy.

But the news Pakistanis most wanted to hear about was money. The Saudi government recently deposited $3 billion in Pakistan’s national bank to shore up its reserves. On this brief visit, officials anticipated Mohammed would sign an unprecedented agreement to invest $8 billion on a new oil refinery in Pakistan’s Gwadar seaport and commit to further investments in water and energy development. 

After arriving a day late and well after dark, Mohammed was personally driven by Pakistani Prime Minister Imran Khan to his official residence. After a formal banquet with a traditional dance performance, they formally signed a number of financial agreements worth $20 billion, reportedly including the Gwadar deal. 

Mohammed, speaking briefly at the dinner, said this was only the “first phase” of a deepening collaboration and added that “we cannot say no to Pakistan . . . We are creating a great future for Saudi Arabia and Pakistan.”

The Saudi leader’s visit comes at a difficult moment for Pakistan, which has faced angry recriminations from its neighboring rival India since a bombing Thursday, claimed by a Pakistan-based militant group, killed 40 Indian security troops in the disputed border region of Kashmir. India immediately revoked Pakistan’s favorable trade status, and its prime minister threatened military retaliation. 

But international experts said Mohammed’s visit might help prevent a dangerous eruption of tensions with India, where the crown prince is scheduled to travel Monday. During previous flare-ups with India, Pakistan has responded with chest-thumping rhetoric, but this time, aside from pro forma denials of support for terrorism, the government was more focused on Mohammed’s trip.

Pakistan has few friends abroad. It is the sworn enemy of India and Israel, a former backer of the Afghan Taliban regime and a military-dominated democracy that has long appeased and sheltered Islamic extremist groups. Its Cold War-era security partnership with the United States foundered after the Sept. 11 terrorist attacks, and its new partnership with China has come with a large debt burden.

But Saudi Arabia is the one powerful ally on which Pakistan has always been able to rely. The two countries signed a friendship treaty in 1951, just four years after Pakistan was founded as a Muslim homeland. Ever since then, the Saudi monarchy has come to its aid. During earthquakes and refugee influxes, periods of financial distress and diplomatic isolation, the Saudis have stepped up with loans, political support and free supplies of oil. 

Millions of Pakistanis work in Saudi Arabia, sending home close to $5 billion in remittances each year. The monarchy has also built a majestic mosque in Islamabad, named after the late Saudi King Faisal, and has long supported seminaries and groups that abetted the rise of ultraconservative Sunni Islam here. 

In the past several years, the relationship cooled over the issue of Yemen. Saudi Arabia intervened militarily in 2015 when Yemen’s president was toppled by the Houthi minority movement, and Pakistan remained neutral instead of contributing troops. But this week, Pakistani officials said Mohammed’s visit sent an important sign of revived amity between the two Islamic republics. 

Khan, a one-time cricket champion and jet-setting playboy with a progressive social agenda, is far more liberal than Nawaz Sharif, his predecessor, who was close to the Saudi royal family. As a candidate, Khan vowed he would never go begging abroad. But when he took office in August, he inherited a foreign debt crisis, plummeting currency and other financial ills. He has since traveled twice to Saudi Arabia, and returned with substantial assistance. 

The importance of the relationship to Pakistan also meant that Mohammed was unlikely to face any direct criticism on human rights issues. Khan, responding to reports of poor conditions for Pakistani laborers in Saudi Arabia, publicly asked him at dinner to treat them “as your own people.” But there was no mention of more remote cases like the killing of Khashoggi, a contributing columnist for The Washington Post. Before leaving Monday, the crown prince will be ceremonially awarded Pakistan’s highest civilian honor. 

The wealthy prince’s every need is being accommodated, although his government is footing much of the bill. More than 300 Toyota Land Cruisers have been reserved for his entourage, and two cargo planes have delivered his personal gym equipment to the prime minister’s residence, where he will spend one night, as well as seven BMWs to ferry him and close aides through the capital. 

The security arrangements have been extraordinary, with thousands of armed forces scheduled to guard various venues and Saudi security teams working with their Pakistani counterparts for weeks. The capital region will be on high alert during the visit, with sharpshooters stationed on rooftops, airspace to be shut down, cellphone service suspended at times and major roads blocked.