The three-year American campaign has largely achieved its goal of reclaiming territory in Syria and Iraq, and the Islamic State’s religious state, or caliphate, appears all but gone. Still, senior military commanders and counterterrorism specialists caution that the organization remains a dangerously resilient force in Iraq and Syria, and a potent global movement through its call to arms to followers on social media.

“As they lose the caliphate’s physical terrain, they’ll adapt guerrilla tactics,” Gen. Joseph L. Votel, the head of United States Central Command, which oversees operations in the Middle East, said in an interview during a regional security conference in Bahrain. “ISIS has been beat up pretty bad. But this is a different kind of organization so we don’t know what they might try to add. They’ve been very adaptive.”

Echoing earlier comments by Defense Secretary Jim Mattis, General Votel said American forces will remain in eastern Syria, alongside their Syrian Kurdish and Arab allies, as long as needed to defeat the Islamic State, also known as ISIS or Daesh. “What we don’t want to do is leave a mess,” General Votel said, something “worse than what we found.”

Here at Al Udeid, home to some 10,000 American and other allied troops, commanders are running the air wars not only in Iraq and Syria, but also the campaign in Afghanistan that is expected to increase sharply in the coming months under President Trump’s more aggressive strategy for combating the Taliban, ISIS and other extremist groups there.

For now, though, the bulk of the 300 combat aircraft under General Harrigian’s command are concentrating on the Islamic State. “Job One still is to get to the military defeat of ISIS,” General Harrigian said. “We need to make sure we stay focused on that.”