On August 17, Pakistani army chief Gen. Qamar Javed Bajwa visited Saudi Arabia to meet with Deputy Defense Minister Khalid bin Salman, younger brother to the kingdom’s de facto ruler Crown Prince Muhammad bin Salman (aka MbS). The trip came at a time of growing Pakistani friction with Riyadh—historically perhaps its closest ally—regarding the fate of Kashmir, the divided and disputed Muslim-majority region that has locked Islamabad in bitter conflict with India for decades.

Indeed, the issue has split much of the Islamic world for months now. Last December, Malaysia organized a conference with Kashmir on the agenda. Given the subject matter and attendance list—which included Saudi rivals Iran and Turkey—Riyadh pressured Pakistan to withdraw, which it did at the last moment even though it had been one of the meeting’s prime backers.

Then, earlier this month—the first anniversary of New Delhi’s decision to forcefully suspend much of the autonomy formerly held by Indian Kashmir—Pakistani foreign minister Shah Mahmood Qureshi demanded that the Saudi-based Organization of Islamic Cooperation call for a ministerial meeting on Kashmir, suggesting that otherwise Pakistan would hold its own meeting. This and other posturing prompted Riyadh to freeze the $3.2 billion oil credit facility it had previously granted to Islamabad and insist that the country pay back parts of a $3 billion loan early.

Their spat over Kashmir seems to stem from a shift in Saudi foreign policy. Apparently, MbS sees the kingdom’s relations with India’s world-class economy as more important than its ties with Pakistan—despite years of financing Islamabad’s nuclear program to such a degree that many assume the Saudis could call on this foreign arsenal in the event of a dire security crisis in the Gulf. But the geopolitical angle overlaps with a religious one: by seemingly marginalizing the situation in Muslim-majority Kashmir, Riyadh is creating room for Turkey, Iran, or other actors to challenge its claimed leadership of the Islamic world and perhaps even the Saudi king’s traditional role as “Custodian of the Two Holy Places” in Mecca and Medina.

Against this backdrop, General Bajwa’s August 17 visit looked like an attempt to delay a train wreck in bilateral relations, and it is unclear if he succeeded. Ahead of the trip, a Pakistani cabinet minister claimed that issues with Saudi Arabia had almost been sorted out, “and the rest of the issues, if [they] still exist, would also be settled” during the visit. After the general’s return, however, statements from the armed forces characterized the talks as “primarily military” in nature. Similarly, in a television interview the next day, Prime Minister Imran Khan played down the bilateral differences: “The rumors that our relations with Saudi Arabia have soured are totally false.” But he did not detail any progress on the financial issues or Kashmir, implying that there was none to report.

This news is troubling given the brewing domestic crisis in Pakistan, whose parlous economic circumstances will only be exacerbated by the withdrawal of Saudi cash. Chinese assistance might fill the gap, but it comes with conditions that could upset Islamabad’s negotiations with the IMF. On August 20, Qureshi flew to Beijing for what was described as a “very important” meeting.

In political terms, General Bajwa is more powerful than Prime Minister Khan, whose 2018 electoral victory is often credited to the fact that the military disliked the other candidates and backed him. The general’s main lever in dealing with Riyadh is his control over security and nuclear policy. But recent reports suggest that although Pakistan may have offered the Saudis nuclear assistance years ago, China now dominates this role. Any future Saudi willingness to back Islamabad’s policies on Kashmir and other issues may also be tempered by Riyadh's desire to ease the India-Pakistan nuclear rivalry.