MANY chefs have stirred the cauldron of war consuming Syria and Iraq, but perhaps none so vigorously or with so long and capacious a spoon as the Islamic Republic of Iran. Unlike the American-led international coalition formed to combat Islamic State (IS) following the radical Sunni Islamist group’s summer surge towards Baghdad, which has limited its role to air strikes, and unlike Russia or the Arab countries that have armed opposing sides in Syria, Iran has physically inserted itself in the intertwined conflicts. It has dispatched not just fuel and weapons but hundreds of “advisers” from its elite Revolutionary Guards Corps (IRGC) as well as thousands of fighters from the Shia militias that Iran has fostered, armed, trained and funded in Lebanon and Iraq.

Two events in the Iranian capital, Tehran, on December 29th underscored the depth of its commitment. In the morning politicians and top military brass paid funeral honours to Hamid Taqavi. Felled by a sniper in the Iraqi city of Samarra, the IRGC brigadier-general, a hero of the 1980-89 Iran-Iraq war, was the most senior Iranian officer killed so far fighting in Iraq. Shortly afterwards the defence minister, Hossein Dehghan, formally received his Iraqi counterpart, Khaled al-Obeidi. At a subsequent press conference Mr Dehghan pledged Iran’s aid in joint efforts to “cleanse” Iraq of terrorism.

Iran’s involvement in neighbouring conflicts is not new. Mr Dehghan himself served in Lebanon during its 1975-89 civil war. As an operative for the IRGC, the ideological spearhead of Iran’s revolution, he may take some credit for the creation of Hizbullah, Lebanon’s powerful Shia militia, and perhaps for exploits such as its bombing of an American barracks in 1983.

Such personal and institutional links have heavily influenced Iran’s subsequent regional strategy. What was seen as Hizbullah’s successful guerrilla campaign to hound Israel from its long occupation of southern Lebanon helped prompt Iran to sponsor a similar effort in Iraq, to oust the American forces following their invasion in 2003. Its instrument was Shia militias that launched thousands of deadly attacks against American troops.

A close ally of the regime in Syria since the 1980s, Iran was quick to bolster Bashar Assad when his people rose up against him in 2011. Syria provides not only a physical bridge to Hizbullah. It is a linchpin of what the IRGC views as a “resistance” axis against perceived American efforts to assert hegemony on the region.

Without Iranian aid Mr Assad might well have fallen; more than a thousand Shia militiamen have been killed in his defence since 2012. Iran has also lost at least three generals in Syria. Syrian opposition sources claim that Iran has also spent as much as $15 billion in aid, much of it in the form of fuel, to prop up the Syrian regime.

The cost of this to Iran—in blood and treasure—has not been counted and is likely to become more burdensome as the oil price falls. Yet Iran’s entanglement, like America’s, is already twisted with contradictions. Hardline Iranian politicians ritually blame America for spawning groups such as IS, even as the IRGC and America share the burden of eradicating it. Iraqi Shia militias threaten to attack any American or allied “invaders”, even as they enjoy coalition air cover. And in Syria Iran has just as little idea as anyone of how the endgame might play out. Even though bolstered by both Iranian help on the ground and, effectively, by American air power, Mr Assad no longer wields the strength or credibility to rule much more than a rump of his devastated country.