EVEN within his ruling circle, Muhammad Morsi, Egypt’s president, has looked increasingly embattled and isolated since his slim electoral victory last June. More than half of his score of official advisers have abandoned him, along with his vice-president, his minister of justice and numerous sundry bureaucrats. On April 23rd Fuad Gadallah, his most senior legal adviser, angrily resigned, issuing a public letter that cited a lack of vision; failure to achieve revolutionary goals or to empower the Egyptian youth; failure to accommodate or even consult political opponents; and the overweening influence of Mr Morsi’s fellow Muslim Brothers in devising policy.

But Mr Gadallah, who is regarded as very much a fellow-travelling Islamist though not an actual Muslim Brother, offered a final justification that jarred with his blunt overall critique. Mr Morsi, he declared, was pandering dangerously to the Islamic Republic of Iran. His move to open Egypt’s doors to Iranian tourists threatened to swamp the country in a Shia tide, warned Mr Gadallah. It risked “the return of the Fatimid state and an infiltration of Iranian money and interests in the service of their goal of eliminating the Sunni sect from Egypt.”

Such stridency seems odd. Egypt’s 90% Muslim majority has been solidly Sunni since the 12th century, when the warrior-hero Saladin reimposed Sunni orthodoxy after routing the Fatimids, an illustrious dynasty of Ismaili Shias which had ruled for two centuries. There is no sign of an imminent Shia revival. The trickle of curious Iranian tourists visiting since Egypt eased visa restrictions, after three decades of strained ties, make an unlikely spearhead for fanatical Persian hordes.

Yet Mr Gadallah’s sectarian twitchiness is widely shared. Across the Muslim world, the millennial but long-dormant Sunni-Shia split has deepened in recent years, largely because of competition between Iran and Saudi Arabia played out in proxy struggles, from Iraq and Bahrain to Lebanon and, most viciously of late, Syria.

Among Sunnis, who make up nearly nine-tenths of the world’s Muslims, the influence of Saudi-style puritanism has risen. It is reflected in Egypt by the electoral strength of Salafist parties that fiercely reject anything alien to the “pure” faith of Islam’s founding fathers, including Sufi mysticism or Shia veneration of imams or descendants of the Prophet Muhammad. Salafist protesters loudly denounced the visit to Egypt in February of Iran’s president, Mahmoud Ahmadinejad, and besieged the Iranian ambassador’s house.

The irony is that such displays of Sunni chauvinism cause deep discomfort to the Muslim Brotherhood, the most successful Sunni champions of political Islam. For decades the Brothers have argued for a pan-Islamic alliance to fend off pernicious Western cultural influence. Their ties to Iran’s harder-line religious establishment date to well before the 1979 Islamic revolution. As far back as 1954, Egypt’s Brothers played host in Cairo to Navvab Safavi, a firebrand Iranian cleric whose followers assassinated half a dozen secular Iranian politicians before his trial and execution in 1955. Ayatollah Ali Khamenei, Iran’s supreme leader, himself translated into Persian works by Sayyid Qutb, the Brotherhood’s leading ideologue (who was also executed, in 1966). The Brotherhood long and bitterly criticised Egypt’s secular leaders, including the former president, Hosni Mubarak, for acting as American lackeys by shunning Iran.

Mr Morsi’s moves to strengthen ties with Iran have not so far yielded much, other than exchanges of official visits and vague promises. But they have annoyed not just fellow Egyptian Islamists. The Muslim Brothers in Syria, a big component in the opposition to President Bashar Assad’s Iranian-allied regime, are having a hard time explaining their Egyptian siblings’ friendliness to Iran. Nor are Iran’s richest foes, Saudi Arabia and the United Arab Emirates, amused. Unlike other countries in the region, including Iraq, Libya, Qatar and Turkey, they have signally abstained from doling out money to bolster Mr Morsi and Egypt’s floundering economy. Having waited for years to lead Islam to glory, the Brothers are finding once again that not all their fellow Muslims are so eager to fall in line.