BEIRUT — Even as internationally backed forces chip away at Islamic State-held territory in Syria, Iraq and Libya, the militants have demonstrated a stubborn resilience this week in the face of recent losses.

Forces of the militant group, which is also known as ISIS or ISIL, dealt an embarrassing setback to the Syrian army near the militants’ self-styled capital of Raqqa with a swift counteroffensive that rolled back incremental gains by troops loyal to President Bashar Assad.

Pockets of extremist fighters north and west of Fallujah continued to hold off elite Iraqi special forces Wednesday, preventing them from making significant advances one month after the government launched its campaign to retake the city west of Baghdad.

And in the battle for the Libyan city of Sirte, pro-government forces besieging the ISIS stronghold were stunned by renewed clashes there, with 36 people killed, a hospital spokesman said.

Just two weeks ago, the Islamic State had suffered setbacks in all three countries in the region where the Sunni militant group captured large tracts of territory in Iraq and Syria two years ago.

Seesaw battles raged in Syria’s Raqqa province, with ISIS fighters retaking areas from government forces Tuesday. Two days earlier, the Syrian troops briefly seized an ISIS-held oilfield in Thawra and threatened to retake the Tabqa air base, which would have opened a direct line for troops to the city of Raqqa.

The government began its highly publicized campaign to retake Raqqa on June 2.