Describing Islamic State as “nimble” and “opportunistic,” President Barack Obama recently warned that the struggle to defeat it will be lengthy and replete with setbacks.

“This will not be quick,” he said. “This is a long-term campaign.”

Obama, of course, is right.

Islamic State, a Sunni jihadist organization intent on forming a caliphate, has cut a swath of terror throughout the Middle East by means of territorial conquests, beheadings of foreign journalists and aid workers, harassment and persecution of Shiites, Christians and Yazidis, desecration of priceless archeological sites and objects and the sexual enslavement of Yazidi women and girls.

It’s clearly on a roll and decades may elapse before it can be subdued, much less defeated. In the worst-case scenario, Islamic State may well succeed in enlarging its territorial holdings in Iraq and Syria, confounding the best efforts to stop it cold in its tracks.

In a bid to slow its advance, the United States and allied nations began launching air strikes against Islamic State last year, starting operations in Iraq on August 8 and in Syria on September 23. Since then, the international coalition ranged against Islamic State — countries running the gamut from Saudi Arabia and Jordan to Canada and France — has carried out almost 6,000 sorties, killing thousands of its fighters and bombing its bases, armed columns and forward positions.

Islamic State has recovered from these blows resiliently.

Last month, the United States intensified aerial attacks against oil and gas facilities held by Islamic State in Syria — where the regime of President Bashar al-Assad has been fighting a wide array of secular and Islamist rebels, including Islamic State, since 2012.

On another front, the United States has deployed more troops to Iraq to train and assist the largely ineffectual Iraqi armed forces, which have been in the forefront of resisting Islamic State advances.

There are currently 3,550 U.S. trainers and advisers in Iraq, far fewer than at the height of the American military involvement a decade ago. The United States officially withdrew troops from Iraq at the end of 2011, leaving behind a small residual force to guard the U.S. embassy and consular offices and to train Iraqi troops. But in the face of Islamic State successes since 2014, the Obama administration has beefed up its garrison in Iraq.

Islamic State, an offshoot of Al Qaeda, has been in an expansionist mode for the past two years. It sent shock waves across the region by conquering Mosul, Iraq’s second largest city, and Tikrit, the home town of ousted Iraqi president Saddam Hussein. Subsequently, Islamic State took the town of Ramadi.

Islamic State completed these conquests with a fairly modest force. Iraqi soldiers put up little resistance, abjectly surrendering or retreating as they left their American weapons and heavy equipment on the battlefield.

Prior to these battles, Islamic State captured the Iraqi town of Falluja and the northeastern Syrian city of Raqqa, which has since become its de facto headquarters.

Islamic State’s empire now stretches from the suburbs of Aleppo, in Syria, to the outskirts of Baghdad, the capital of Iraq. Islamic State may well have advanced into Baghdad had it not been for the fierce resistance of Iraqi Shiite militias, which are aided by Iranian advisers and trainers.

Thanks to American and allied air power, Iraqi land forces have wrested Tikrit from Islamic State, and are now trying to regain Ramadi.

Of late, Islamic State has further unsettled already frayed nerves by setting off a series of suicide bombings, which have killed scores of Iraqis. On August 13, more than 60 Iraqis were killed in Sadar City, a Shiite neighborhood in Baghdad. Last month, a bombing in Diyala province claimed the lives of about 100 people.

In Syria, Islamic State lost Kobani, a town on the border with Turkey, but regrouped and captured Palmyra, renowned for its ancient artifacts.

Last month, following a suicide bombing in the Turkish border town of Suruc that killed 32 people, Turkey officially declared war on Islamic State. Turkey, which has been a conduit for Islamic State recruits streaming into Syria, claimed that a Turk with suspected ties to Islamic State had detonated the bomb.

On this pretext, Turkey launched air raids against Islamic State targets in Syria and granted the United States permission to use two of air bases. Turkey, which has used the crisis to renew the war with its old enemy, the Kurdish Workers’ Party, plans to establish an Islamic State-free zone along a 60-mile strip of its frontier with Syria.

Turkey’s entry into the war will surely place additional pressure on Islamic State, but if the past is any guide, it will adapt to changing circumstances.

Claiming to represent the interests of aggrieved Sunni Muslims in Shiite-dominated Iraq and Syria, Islamic State has won a measure of favor in occupied areas by projecting a sense of order and providing basic services and jobs. Opponents are terrorized into submission or simply murdered. Islamic State does not tolerate dissent.

Islamic State affiliates, meanwhile, are sowing mayhem.

Sinai Province, the Egyptian jihadist group which has pledged allegiance to Islamic State, reportedly carried out its first beheading of a foreigner this month. The victim, Tomislav Salopek, was a 30-year-old Croatian surveyor working in the oil and gas sector. Usually, Sinai Province sets its sights on Egyptian army bases, patrols and government offices. In these guerrilla attacks, hundreds of soldiers and administrators have been killed.

Sinai Province has also fired rockets into southern Israel, targeting the port of Eilat. The Shin Bet security agency has broken up several cells loyal to Islamic State and indicted dozens Israeli Arab supporters.

Israel’s neighbor, Jordan, is building a barrier on its northern and eastern borders to keep out jihadists from Syria and Iraq. Jordan has taken delivery of 16 decommissioned Cobra combat helicopters from Israel to better defend its borders. Last January, the Jordanian Air Force bombed Islamic State bases in Syria after one of its pilots was shot down and burned alive by Islamic State in a gruesome ceremony publicized on social media.

Saudi Arabia — the cradle of Islam and a member of the U.S. coalition — has come under attack by Islamic State, which considers the Saudi kingdom a heretical entity. Islamic State has targeted Shiite mosques and institutions, killing tens of Saudis.

It’s abundantly clear that Islamic State, with some 30,000 fighters and hundreds of millions of dollars at its disposal, intends to fight a protracted war until it achieves its primary objective — the establishment of a caliphate encompassing the Middle East.

Islamic State may yet fall short of its grandiose aim. But in the meantime, it’s on the ascendancy, and many years may pass before this horde of barbarians runs out of steam or is militarily worn down and defeated.