This question merits asking, not only because Ahmadinejad’s decision damaged the regime’s image at home, but because it has also embarrassed Iran abroad. While Iran’s president was falling over himself to attend the Mecca summit, Saudi King Abdullah is unlikely to reciprocate by attending an upcoming summit of the Non-Aligned Movement in Tehran. Khamenei surely knew this, yet he let Ahmadinejad go.

The government’s poor performance is reminiscent of the failure of President George W. Bush’s administration to provide assistance to the victims of the 2005 hurricane Katrina. While clearly struggling to cope with the disaster alone, however, Iran also initially spurned offers of outside help from the United States and Turkey and did not appeal to United Nations or other international relief organizations. An important question is, why did Ahmadinejad’s boss, Supreme Leader Ayatollah Ali Khamenei, let the president go to Saudi Arabia in the wake of the earthquake? As Iran’s most powerful figure, counteracting Ahmadinejad’s plans would have been well within Khamenei’s remit.

Two days after the earthquake, while Ahmadinejad was in Saudi Arabia, only two surgeons had arrived at damaged villages near the town of Ahar, according to Mehr News . Meanwhile, survivors had to wait more than 40 hours for food. Many were forced to drink water from unsafe sources due to lack of clean water.

For Ahmadinejad’s domestic adversaries, his decision to go ahead with plans to attend the summit of the Organization of Islamic Cooperation in Mecca was like throwing fresh meat to circling piranhas. Iran’s presidents have never been short of rivals or criticism and that has been particularly so for Ahmadinejad, who has lost much of his clout in recent months and whose term in office ends in less than a year. However, Ahmadinejad’s decision to shun those affected by the earthquake has opened him up to new charges of insensitivity and arrogance.

An earthquake Saturday, August 11 that killed hundreds and injured thousands in Iran’s East Azerbaijan province has sparked harsh criticism of the Iranian government and especially of President Mahmoud Ahmadinejad, who chose to visit Saudi Arabia two days after the disaster instead of the afflicted areas of his own country.

One theory could be that Khamenei is eager to improve relations with the Saudis and is willing to go to extra lengths to reach out to them. While possible, this rationale is contradicted by the fierce rivalry between Iran and Saudi Arabia that is being played out in Syria, Iraq and Lebanon.

Another scenario is that Khamenei let Ahmadinejad go to make him the sacrificial lamb for the Leader’s own shortcomings. With the country’s economy suffering greatly because of corruption, mismanagement and sanctions, what better way for the Supreme Leader to distract attention and responsibility from his own failings than by helping Ahmadinejad make himself public enemy number one? The more tongues lash out at the president and the more column inches are written against him in Iran’s newspapers, the less the public will focus on the damage that Khamenei’s policies, particularly regarding the nuclear issue, are causing.

Additionally, by allowing Ahmadinejad to make the mistake of going to Saudi Arabia instead of the affected areas in Iran, Khamenei has now completely destroyed any chance that Ahmadinejad’s allies might have had to score a victory in next year’s Iranian presidential elections. Rural areas have been Ahmadinejad’s strongholds. Small towns and villages have been the only places where he had any popularity — certainly not the big cities. Now that Ahmadinejad has turned his back on the residents of Ahar, Haris and Varzaqan in rural parts of Eastern Azerbaijan province, why would people in other rural areas want to support him or his allies?

Still, whatever efforts are made to pin the blame on Ahmadinejad’s administration, the Supreme Leader and other Iranian politicians would do well to remember that in the long run, the regime in its entirety could suffer because of its poor performance during the current crisis.

It’s not just that aid has been slow to arrive. Newspapers loyal to the regime and the Leader, including Keyhan and Resalat, did not even publish the news about the earthquake on their front pages the day after it happened. Adding insult to injury, Islamic Republic of Iran Broadcasting (IRIB), the state media channel, broadcast a comedy program on Sunday, for which officials at the channel later apologized.

The regime also has to worry that its negligence and callousness could strengthen the voice of those who call for Iran’s Azeri provinces to break away from central government control.

Concern over fueling Azeri separatism may be one reason why the Iranian government rejected offers of assistance from Turkey, which shares some cultural and linguistic features with Iran’s Azerbaijan province. Turkey’s economy is thriving and its popularity is increasing in the Middle East while that of Iran is declining. Turkish offers to send immediate aid to quake survivors while the Iranian president prefers to go abroad could make Turkey even more attractive and a source of inspiration for Iranian Azeris. The same could also apply to the independent state of Azerbaijan on the Iranian province’s border. Even though it is not a democracy, the former Soviet republic is more prosperous and far less isolated than Iran has become.

For now, however, the blame is fixed largely on Ahmadinejad. While in Mecca, he would do well to pray for his political future and that of his dwindling supporters.

Meir Javedanfar is an Iranian-Israeli Middle East analyst. He teaches the Contemporary Iranian Politics Course at the Interdisciplinary Center (IDC) in Herzliya and tweets as @Meir_J