FOR more than three years, Barack Obama has been trying to avoid getting into a fight in Syria. But this week, with great tracts of the Middle East under the jihadist’s knife, he at last faced up to the inevitable. On September 23rd America led air strikes in Syria against both the warriors of Islamic State (IS) and a little-known al-Qaeda cell, called the Khorasan group, which it claimed was about to attack the West. A president who has always seen his main mission as nation-building at home is now using military force in six countries—Syria, Iraq, Afghanistan, Pakistan, Yemen and Somalia.

The Syrian operation is an essential counterpart to America’s attacks against IS in Iraq. Preventing the group from carving out a caliphate means, at the very least, ensuring that neither of these two countries affords it a haven (see article). But more than the future of IS is at stake in the streets of Raqqa and Mosul. Mr Obama’s attempt to deal with the jihadists is also a test of America’s commitment to global security. It is a test that he has been failing until now.

IS et al

The sense that America is locked in relative decline has been growing in recent years, as it has languished under the shadow of the financial crisis and two long, difficult wars. Why should a newly rich country like China take lectures about how to run its affairs from a president who struggles even to get his own budget through? America, meanwhile, seems swamped by the forces of disorder, either unable or unwilling to steady a world that is spinning out of control. IS embodies this frightening trend. It is, in the jargon, a non-state actor, and it thrives on chaos. With each new humiliation of the governments in Iraq and Syria, it has accumulated more wealth, territory and recruits.

Its rise has also reflected American policy. First, the poorly thought-out intervention of George W. Bush, typified by the rash “Mission Accomplished” banner that greeted him on the USS Abraham Lincoln in May 2003 after his invasion of Iraq. Then Mr Obama’s studious inaction. When Syrians rose up against the regime of Bashar Assad, the president stood back in the hope that things would sort themselves out—leaving Mr Assad free to commit atrocities against his own people. Even when Mr Assad crossed “the red line” of using chemical weapons, the superpower did not punish him. About 200,000 Syrians have died and 10m have been driven from their homes. Denied early American support, the moderate Syrian opposition has fragmented, leaving the field to the ruthless and well-organised IS.

Standing back has not worked well elsewhere in the world, either. Mr Obama has spoken about the limits to American power—exhorting other governments with a stake in today’s system to do their bit to keep the world safe. He wanted the United States to be seen less as a unilateral bully, more as the leader of world opinion. Yet when America stepped back, its allies stepped back, too. The countries that most eagerly came forward were its rivals, such as Russia and China.

IS has induced a change of heart among the American people. Before vicious extremists seized the city of Mosul and began to cut off Western heads on social media, Americans doubted the merit of further military action in the Middle East. When they realised that IS threatened them directly, they began to demand protection. Mr Obama therefore has a chance not just to strike a blow for order in the Middle East, but also to give the declinists pause.

From axis of evil to network of death

He has brute force on his side. The disastrous mismanagement of post-invasion Iraq has tended to eclipse the overwhelming potency of American firepower at the beginning. In six short weeks in the spring of 2003 America and its allies defeated the 375,000 troops of Saddam Hussein with the loss of only 138 American lives. Never in history has a single country had such military dominance. It has not suddenly evaporated.

The bigger question is whether Mr Obama can carry off delicate diplomacy. The lesson from Iraq and Afghanistan is that firepower alone will not prevail. Indeed, if America comes to be seen by Sunni Arabs as nothing more than a Shia air force, strikes will only bind IS to the local people.

If he is to win the argument in Iraq and Syria, Mr Obama needs coalitions and partnerships. For that he must get the diplomacy right. So far he has done well. He insisted on the replacement of Nuri al-Maliki, the Shia-chauvinist former prime minister of Iraq, with Haider al-Abadi, who is making efforts to bring Sunnis into government. He sent John Kerry, his secretary of state, to recruit regional Sunni powers such as Saudi Arabia and Jordan, to try to persuade Sunnis in Iraq and Syria that he is not taking sides against their branch of Islam. America has argued to the United Nations that its intervention—requested by Iraq but not Syria—is legal under Article 51 of the UN’s charter. Ban Ki-moon, the UN secretary-general, appears to have accepted that argument; so should Britain’s Parliament, which will vote on whether to help America.

There is much more for Mr Obama to do. The coalition-building is not complete. Turkey, a NATO member, is at last suggesting it favours action against IS, but it needs to be seen to help. Holding the alliance together will require patience, flexibility and a judicious mix of bullying and seduction. Mr Obama will have to put in many more long hours on the telephone with world leaders than he has done so far. And even if he succeeds in substantially destroying IS, new horrors may emerge from the ensuing vacuum if he does not help benign local forces to fill it.

Americans will grumble about the superpower’s lot. Of course, European allies can do more; of course, Asia’s emerging powers should support the world order. But it is also plainly in America’s interest to stay involved—and, when necessary, to show that it will put its might behind right, if only to deter the world’s tyrants and terrorists from further mischief. Although the mission to stop IS will be long and hard, it is one that no other nation could even contemplate. Mr Obama is right to relaunch it. Now he must see it through.