The map of the modern Middle East is being ripped apart.

The border between Iraq and Syria no longer exists. After routing the “Iraqi army” (in reality, little more than a Shiite militia) in Mosul, Sunni rebels, led by the Islamic State in Iraq and Syria (ISIS), symbolically dismantled the border posts between the two countries as their supporters triumphantly took to the internet with the hashtag #SykesPicotOver. That is a reference to the secret agreement between French diplomat François Georges-Picot and the British Sir Mark Sykes in 1916 that was the first step towards the creation of the modern states of Iraq and Syria, and the broader carve-up of the region by the victors of World War One.

The border between Iraq and Syria has been a fiction for at least a year. But the stunning speed with which the revolt has swept across Iraq has shaken the entire region to its core. In the weeks since the takeover of Mosul, ISIS-led forces have consolidated their power over large parts of northern and western Iraq. It is now clear that this is not simply a rebellion by a few thousand fighters from the jihadist group ISIS, but a broad-based Sunni rebellion involving a wide range of political forces, including former Baathists, tribal groups and many others who are far from sympathetic to ISIS’s reactionary politics.

The rebels now control an enormous swath of territory stretching from the outskirts of Aleppo in Syria to just west of the Iraqi capital, Baghdad. Rebels have taken control of strategically crucial cities and towns on, over or near the borders of both Jordan and Saudi Arabia, raising fevered speculation about whether they too will succumb to the tide of revolt.

The fallout from these events is extraordinary.

Tehran and Washington have both been gripped by debate about the possibility of Iranian-US cooperation to fight ISIS. When the neocon hawks, consumed by bloodstained hubris in the weeks after the 2003 Iraq invasion, declared “real men go to Tehran”, they little imagined that a decade later the US would indeed be headed to Tehran – not to invade, but cap in hand, pleading with the Iranians to help them restore order in an Iraq they are now almost helpless to affect.

An indicator of the erosion of US influence in Iraq was the reception given to John Kerry when he flew into the country in late June.

He visited Kurdistan President Mahmoud Barzani in Erbil, asking him to help form a united government in Baghdad to stand against ISIS. Instead, Barzani all but said he was on the verge of seceding from Iraq. Kurdish forces seized Kirkuk and consolidated their position throughout what was already a de facto state in northern Iraq.

When Kerry went to Baghdad to demand that Nouri al-Maliki step aside in favour of a “broad-based inclusive government”, Maliki told him to go jump. In a television address the following day, Maliki rejected any idea of a national unity government. He later announced that he was buying used fighter jets from Russia because F-16 fighter jets ordered from the US had still not arrived.

The Iranians, who have more influence over the situation than the US, are backing Maliki, but there are no guarantees this will continue. The break-up of the country, which Maliki’s approach makes almost inevitable, would likely result in a sectarian Sunni state blocking the land route Iran relies on to move weapons and aid to the Syrian regime and to Hezbollah, which Iran considers to be a crucial element of its ability to project power.

At least two battalions of the Iranian Revolutionary Guard are already active in Iraq fighting ISIS, and Qassem Suleimani, commander of the Quds force and the man in charge of the Iranian units fighting alongside Bashar al-Assad’s regime in Syria, has been in Baghdad coordinating the operation.

US and Iranian interests only partially overlap, but it is increasingly clear to US strategists that Iran is the only power with a chance to stabilise the situation.

The prospect of further US-Iranian rapprochement has sent US allies Saudi Arabia and Israel into a panic. Saudi Arabia has been involved in furious behind the scenes action to derail the process, including holding talks with Russian leader Vladimir Putin.

The Saudi position is mired in intractable contradictions. While hostile to Iran, Saudi Arabia also knows that ISIS is its bitter foe. Claims that the Saudi monarchy backs ISIS are unsubstantiated. It is, however, true that ISIS is backed by sections of the Saudi bourgeoisie cut off from the narrowly based regime that rules the country. One of the reasons they back ISIS is that they support one of its core aims – the overthrow of the Saudi monarchy.

Indicating the level of concern among Saudi rulers, in late June King Abdullah summoned a National Security Council meeting to order a general call-up of all military units and institute “all necessary measures to protect the kingdom against terrorist threats”. And demonstrating the extent to which this crisis is drawing in countries across the region, reports suggest that Egypt is assembling an expeditionary commando force to fly to Saudi Arabia to bolster its border defences.

Israel is now being forced to contemplate whether it is prepared to intervene militarily to defend the Hashemite monarchy in Jordan if it comes under serious threat – an action that would put it in a de facto military alliance with Tehran.

Meanwhile, the Syrian regime, which hardly fired a shot at ISIS as it consolidated its position in eastern Syria over the last 12 months, has finally decided to bomb the ISIS headquarters in Raqqa, and has also bombed Sunni rebel-controlled airports taking deliveries of weapons near the Saudi border in Iraq.

As socialist writer Michael Karadjis has pointed out, this is not likely to be a sign that the Syrian regime is now interested in confronting ISIS in Syria – where the war waged by ISIS on the alliance of Free Syrian Army and Syrian Islamist fighters serves Assad’s purposes. Instead, at a time when Iranian troops and Iraqi Shiite militiamen who have been fighting alongside Assad are pouring out of Syria to join the battle in Iraq, air strikes against ISIS are a message to Assad backers Iran and Russia that the Syrian regime is an important and useful ally.

‘Anti-imperialist’ fantasies unravel

Throughout the three-year civil war in Syria, there has been a fierce debate on the international left between those who backed the uprising against Bashar al-Assad, and those who either defended the regime, or at the very least refused to back the opposition on the grounds that Assad was part of an “anti-imperialist bloc”.

For leftists in the latter category, like Counterpunch writer Phil Greaves, “imperialism” simply means the US and its Saudi and Israeli allies. Syria, Iran and even Russia, whose strategic interests brought them into conflict with the US, are portrayed as playing a progressive role, or at best a benign one.

This is the logic that convinced many to rail against “imperialist intervention” in Syria at the slightest whiff of mostly non-existent aid from the US to Syrian rebel forces, while at the same time explaining away the very real imperialist intervention into the war by Iran and Russia, which has played a decisive role in propping up the Assad regime.

 Events in Iraq over the last month leave such “anti-imperialist” fantasies in ruins. The Saudis are conspiring with the Russians while US diplomats negotiate military tactics with their Iranian counterparts and move towards a détente with Assad in Syria. Israel tries to derail a US alliance with Iran while simultaneously considering whether it needs to intervene in de facto alliance with Iran in Jordan.

If your political approach boils down to putting a tick wherever the US and Israel put a cross, you will quickly find yourself tied in knots. The driving force behind the misery inflicted daily on millions of people across the Arab world, brought to fever pitch in Iraq and Syria at the moment, is not an all-powerful US empire, but a complex system of conflict and shifting alliances between the ruling classes of states big and small.

All of these ruling classes are driven by the same pragmatic capitalist logic: make alliances and fight wars based on what will improve your geostrategic position and secure the greatest economic and political advantage relative to your rivals.

It is true that the divisions that rack the Middle East are as vicious as they are because of the cold-blooded manner in which the old imperial powers divided up the Arab world a century ago, and the endless cycle of interventions from those powers that have followed since.

But the British, Russian, French and US imperialists are no longer the only independent powers in the region. Iran, Saudi Arabia and Egypt – though all intertwined in alliances with other countries big and small – are powerful capitalist states in their own right, playing the imperialist game, not mere clients of bigger powers. Furthermore, the ruling elites of the many smaller countries fit into the network of alliances and divisions not simply as pawns, but as defenders of their own interests and those of their local capitalist class.

But the maelstrom that has descended on the Middle East is not simply a product of conflict between the elites. The most important factor is the enormous and increasing gap between rich and poor in the Arab world, and the tensions and instability that flow from that.

The current conflict in Iraq has specific roots in the US war and occupation, but it is also a product of the despair, oppression, displacement and poverty that led to the outbreak of revolutionary struggles across the Middle East in 2011. The fact that the struggle in Iraq is now morphing into a region-wide conflict is indicative of the fact that the old order, characterised by brutal authoritarianism and class divisions, is everywhere cracking apart.

Whether this crisis eventually leads to new mass struggles that break through the poison of sectarianism and start to articulate a vision of a new, united struggle of the Arab masses against parasitical rulers of all stripes, or spirals into an even deeper hell of sectarianism and social disintegration, it is impossible to say.

But in the darkest hours it is worth remembering the first days of the Arab revolution, the days before it was called a revolution, when the young people who put their bodies against the bullets and the tanks and declared they would bring down dictatorships were dismissed as hopeless dreamers who did not understand the realities of the Arab world.

The hope that drove those nameless heroes, and the millions who took to the streets after them, has not yet been realised. But their extraordinary feats counted for more than anyone, friend or foe, ever predicted. It would be a brave person who claimed that sectarian barbarism is the only possible future, and that the day of the Arab revolution has passed.