IN THE mid-1990s a celebrated Syrian playwright captured the anguish of living under an Arab autocrat with the lament, “We are condemned to hope.” Almost 20 years later, even hope has withered.

The Middle Eastern order sustained by the United States has collapsed. Civil wars are devouring Syria, Iraq and Libya. Black-robed jihadists from Islamic State (IS) have carved out a caliphate. Vying with Iran for regional influence, Saudi jets are strafing Shia rebels in Yemen. Peace may not return to the Middle East for a generation.

For most Arabs, including presidents and kings, the lesson is that American power has had its day. For most Americans, including the man in the White House, the lesson is that outsiders cannot impose order on chaos. Both claims are exaggerated. The Middle East desperately needs a new, invigorated engagement from America. That would not only be within America’s power, it would also be in America’s interest.

Desperate times

The starting-point is to understand what has gone so disastrously wrong in the Arab world. Democrats in Washington will tell you that the villain is George W. Bush, who invaded Iraq in 2003, creating a bloodthirsty Sunni insurgency and, across the region, a hunger for rebellion. Republicans insist that the fault lies with Barack Obama for letting Iran dominate Iraq and failing to curb the villainy of Syria’s Bashar Assad.

In fact there is more than enough blame to go round. As that Syrian playwright suggested, the roots of the Arab malaise run deep. After the second world war, centuries of infantilising colonial rule gave way to woeful self-government. Arab economies were regulated, subsidised and planned so clumsily that they failed to provide for Arab citizens. Leaders, lacking legitimacy, took refuge in Arab nationalism and came to depend on coercion instead of consent. Young populations without prospects found comfort in religion, some in the zealotry peddled by the likes of IS. For years America propped up its client states in this failing order. But the Arab spring showed that the stability Mr Bush shattered at such great cost was already doomed. Mr Obama’s inaction only added momentum to an unfolding catastrophe (see article).

All the more reason to stay out, perhaps. Except that America has interests in the Middle East. Today’s chaos is trashing human rights and torching values that many, including this newspaper, look to America to defend. Not everyone will agree—some Americans are tired of their country acting as a global policeman, and others rightly point out that its geopolitical priority is China’s growing ambition (see Banyan). But even allowing that, the Middle East still matters.

Terrorism in places like Libya or Syria sooner or later ends up striking at the West. IS’s successes in Ramadi in Iraq and Palmyra in Syria attract money and fighters. Minimising the threat means doing more in places where jihadism flourishes.

Then there is oil. Thanks to fracking, the United States has become the world’s swing producer, and within a decade or so the North American continent stands to produce as much energy as it consumes. But the oil price is global, and the Middle East still accounts for one in every three barrels of seaborne crude. Pricing power and self-sufficiency do not make America immune to upheaval in energy markets. If it cannot keep the oil flowing, its economy will suffer grievously and so will its claim to global leadership.

An interactive guide to the Middle East's tangled conflicts Last is nuclear proliferation. America has sponsored a deal to prevent Iran from gaining the bomb for at least a decade. If the talks succeed, America will need to act as enforcer-in-chief. If they fail, it must be at the centre of efforts to prevent Iran crossing the nuclear threshold. Either way, it must be a brake on other regional powers who might think of launching weapons programmes of their own. Mr Obama has identified all these interests. His diplomats were in Paris this week to talk about IS. This month they will be thrashing out the nuclear deal with Iran. He has personally pledged to ensure oil supplies flow. And yet his goals are undermined by his determination to stand back from the region. His aim has been to force the Middle East to take more responsibility for running its own affairs. But the vacuum he has created has only exacerbated the strife and disorder.

In the Middle East, America risks over-learning from the failures of the past Instead, Mr Obama needs to set out a strategy of constructive containment. No actor can simply put the Middle East together again, but America can help stop the damage spreading. The first requirement is better diplomacy. Mr Obama has shunned the State Department, preferring a coterie in the White House. Partly as a result, America was ill-prepared for the coup by Abdel-Fattah al-Sisi in Egypt. When Mr Obama withdrew troops from Iraq, he should have emphasised diplomacy and built up Iraq’s institutions. Instead, Iranian influence grew and the Shia-led government alienated Iraq’s Sunnis. More political engagement is needed. America must not give up striving to end the conflict between Israel and Palestine. But Mr Obama also needs to work with Turkey to create a moderate force in Syria and with Saudi Arabia to stop the fighting in Yemen. And he should encourage economic and political reform in the Gulf and Egypt, which cling to a moribund “stability” for fear that change will run amok. He must be ready to use force. Mr Obama’s taboo about deploying American soldiers against IS in Iraq has led to a self-defeating shortage of special forces to guide air strikes to their targets.

Desperate measures

This work is dogged and often thankless. America must accept that its relations with Arab countries will be pragmatic. Fighting alongside Iran in Iraq and opposing it in Syria is a contradiction. Get used to it: the region has not stopped shifting in unreconcilable ways. The Iraqi Kurds are useful allies even though—against American policy—they want their own homeland. America may need to deal with Mr Sisi to calm Libya.

The idea has taken root that America no longer has what it takes to run the Middle East. That it ever could was an illusion. But America still has a vital part to play. If it continues to stand back, everyone will be worse off—including Americans.