BAGHDAD — Just last month, when Western and Iraqi officials talked about the Islamic State, it was mostly to list a series of setbacks to the terrorist group: defeated in the Syrian town of Kobani, battered by a heavy airstrike campaign, forced out of a growing list of towns and cities in Iraq.

But in just the past week, the Islamic State has turned that story around. Last weekend it solidified its hold on Iraq’s Anbar Province with a carefully choreographed assault on the regional capital, Ramadi. And on Wednesday, it stretched its territory in Syria into the historically and strategically important city of Palmyra.

Confounding declarations of the group’s decline, the twin offensives have become a sudden showcase for the group’s disciplined adherence to its core philosophies: always fighting on multiple fronts, wielding atrocities to scare off resistance and, especially, enforcing its caliphate in the Sunni heartland that straddles the Iraqi-Syrian border. In doing so, the Islamic State has not only survived setbacks, but has also engineered new victories.

“Nobody here from the president on down is saying that this is something that we’ll just overcome immediately,” a senior State Department official said in a briefing with reporters on Wednesday, in which the ground rules required anonymity. “It’s an extremely serious situation.”