When Ibn Saud’s troops seized control of Mecca in 1924, he issued a resounding proclamation pledging to care properly for the holy places and to improve conditions for pilgrims, conditions which had allegedly deteriorated under the previous Hashemite rulers. His assumption of that duty was never fully or clearly accepted across the whole Muslim world, in spite of conferences at which a reluctant acquiescence was extracted from representatives of some countries. But it nevertheless became, and remains, the most important source of legitimacy for a Saudi state riven internally by both political and religious divisions and never popular in a region where most regimes have very different views from those prevailing in Riyadh. Effective guardianship of the holy places became one of the two pillars holding up the unlikely Saudi state, the other being the vast oil reserves soon to be discovered.

That is why last week’s disaster in the Mina valley near Mecca, in which as many as 1,000 hajj pilgrims may have perished, is more than a tragedy. It is unavoidably also a political event which could have large consequences. Nor is it the first such calamity. There was a similar if smaller incident in 2006 and a worse one in 1990. This year’s terrible accident followed another earlier in the month when a crane fell on worshippers at the Grand Mosque. It will lead some to raise the issue of whether Saudi Arabia is, in the technical sense, a modern state capable of using its wealth to ensure high standards of safety and competence, or whether it is so dysfunctional that error and misjudgment are inevitable. This is certainly what its main rival, Iran, is charging.

That country’s supreme leader, Ayatollah Ali Khamenei, has demanded that Saudi Arabia apologise for the deaths, following a speech by President Hassan Rouhani at the UN in which he called for a full-scale investigation. The Saudi authorities have said they will set up an investigation, but the Iranians may well dismiss that as likely to be biased. Iran’s anger is understandable – it lost at least 140 citizens – but Tehran is also using the tragedy as a means of undermining its regional rival. The two countries have been at odds for years but the Syrian civil war, to which now may be added the Saudi intervention in Yemen, have sharpened their confrontation. There have been occasional signs of reconsideration in both Tehran and Riyadh, with some back-and-forth diplomatic contacts last month, for example, but the basic pattern has not changed.

An objective view would be that neither country has the means or the qualifications to dominate the region: Shia Iran because of its ethnic and religious differences from the Arab and Sunni majority of the inhabitants of the central part of the Middle East; and Saudi Arabia because of its peripheral position and small population. The prize for which they are contending, in other words, is beyond either’s grasp. But that does not seem to stop them from trying. At issue in the last resort is the long-term viability of the two regimes. That of Iran certainly has its weaknesses, but it has a measure of domestic stability. Under the relatively moderate President Rouhani, it has been more successful in Syria than Saudi Arabia, and the recent nuclear agreement has strengthened its position.

Saudi Arabia has arguably deeper problems. Falling oil prices make it more difficult to buy off political discontent. The princely class has become too large to be maintained in the style to which it had become accustomed, while the middle and lower classes cannot be indefinitely appeased by further subsidies to the welfare state. The intervention in Yemen was unwise, and the evidence suggests that although war crimes charges are so far formally unproven, there has been a very marked disregard for civilian casualties. Even if the intervention is successful, it will saddle Riyadh with a costly task of management and reconstruction that could last for years.

The competence of the men at the top is thus a critical matter. King Salman is thought to be infirm, the position of Crown Prince Mohammed bin Nayef, as the man in charge of hajj safety, has been weakened, while the ambitions and style of Prince Mohammed bin Salman, deputy crown prince and main driver of the Yemen adventure, have reportedly led to criticism within the royal family and doubts about the succession, supposed in the future to be ensured by consensus. How far the whole system is under strain is hard to guess, given the opaqueness of the regime, but an accident of this order, in the context of the country’s other difficulties, must bring with it some very serious questions.