THE advance of ISIS towards Jordan has made its royal rulers shudder. The jihadists’ definition of Syria spans all of the Levant, including Jordan, which is draped in the black flag of jihad on ISIS maps. On June 22nd ISIS fighters took over the Turabil crossing point, the only official one between Iraq and Jordan. The day before, ISIS had conquered Rutba, an Iraqi town an hour’s fast drive eastwards on the road from Jordan’s border towards Baghdad. In the past few days, ISIS has taken over all the crossings along the border between Iraq and Syria, except for one at Rabia, which is controlled by Kurds.

Until recently, Jordan’s Hashemite rulers have had reason to laugh last. For decades Arabs have ridiculed their kingdom as an artificial construct of British imperialism waiting to fall apart. Powerful neighbours treat it as their buffer. Saudi Arabia bankrolls it, for it has little wealth, and Israel, with which it has discreetly cosy relations, guards its borders with drones. Yet, as the region’s sectarian wars threaten to sweep away borders, King Abdullah has survived as the leader of the Fertile Crescent’s last functional and fairly calm state. Unlike his neighbours, whose countries contain multiple sects, he is blessed with a citizenry that is almost entirely Sunni Arab.

Many Jordanians had previously stressed the positive aspects of ISIS’s advance. Mayhem next door turned Amman, the capital of the country, which has no coastline suitable for holiday-makers, into a favoured inland summer resort for sweltering Gulf Arabs with deep pockets. Roads have recently been clogged with cars bearing Saudi number-plates, their occupants encamped in Jordan’s breezy hills, waiting for the imminent month-long Muslim fast of Ramadan. Luxurious hotels, including a new St Regis, are sprouting in west Amman to embrace them. Developers have turned the city’s former intelligence headquarters into a shiny office-and-shopping complex.

Yet the poor of Jordan taste few of these fruits. No one seems to know where the billions of dollars that the Gulf states have allocated for capital projects have gone. Once the prime employer of Jordan’s Bedouin, the country’s indigenous bedrock, the armed forces can no longer absorb their rapidly growing population. In scrubby provincial towns and the shanties rimming the capital, youth unemployment tops 30%. Promised political and economic liberalisation has slackened. “Should ISIS choose to come, the ground is prepared,” says a prominent businessman. “For money, our people will do anything.”

Jordanian membership of Salafist groups, ranging from those who want to join the political system to those who are bent on fighting it, may number as many as 8,000. Perhaps another few thousand, reckons a diplomat, count themselves as jihadists. More Jordanians have joined the ranks of Syria’s assorted Sunni rebels than any other nationality; the late founder of ISIS’s progenitor was a Jordanian, Abu Musab al-Zarqawi.

Some radical Islamists in Jordan are looking hopefully inwards. In April jihadists chased the police out of Maan, a turbulent provincial town in the dusty south. They pledged allegiance to ISIS’s leader, Abu Bakr al-Baghdadi, and decked the mosque with images of local jihadists killed in Syria. Salafists in Amman replay footage on social media of Maan’s youth shredding their Jordanian passports and pronouncing death to the king.

Since then, Jordan’s security forces have ringed Maan with armoured vehicles and checkpoints; countrywide over a hundred Salafist troublemakers have been imprisoned. A new anti-terrorism law bans association with Syria’s blacklisted groups. Up till now, Jordanian border guards have let jihadists cross the frontier into Syria and Iraq, where they are welcome to die, but jail them if they return. In May Jordan’s air force launched strikes on returning fighters fleeing from a Syrian army offensive in the south. “The message is, we’ll use deadly force” against them, says a Jordanian official.

More artfully, Jordan’s intelligence service has been playing jihadist groups off against each other. On June 16th Mr Zarqawi’s Salafist mentor, Sheikh Abu Muhammad al-Maqdisi, was released from prison, but not before he had been persuaded to issue two fatwas declaring followers of ISIS as “deviants” and telling them not to make attacks in Jordan.

Leading sheikhs, too, deride ISIS. In his office at the back of an Amman bakery, Usama Shehadeh, the author of “The problem with Shias” and other Salafist works, portrays ISIS as a duplicitous Iranian menace. Since its formation, ISIS and Syria’s army have rarely fought each other, he notes conspiratorially, instead devoting both their arsenals to fighting other Sunni groups.

While Jordanian officials focus on ISIS sympathisers within, the vast influx of refugees from multiple sects is threatening to muddy Jordan’s character as a uniform Sunni Arab state. ISIS’s conquests in Iraq are fuelling Jordan’s fears of yet another wave of refugees to follow the hundreds of thousands that have already spilt out of Syria. With the retreat of Iraq’s armed forces to Baghdad and their scuttle from the main border crossing into Jordan, King Abdullah’s forces have rushed to reinforce towns near the border. “No Iraqi can come in without a visa,” says an official. ISIS, however, is unlikely to apply for one.