For three years, the Syrian city of Raqqa was the Islamic State’s greatest stronghold, featuring heavily in propaganda and providing a launchpad for attacks carried out around the world.

But district by district, the city is now emptying out as U.S.-backed forces inch their way through the extremist group’s self-proclaimed capital in Syria. The two sides are locked in a grinding battle of attrition that ranks among the toughest chal­lenges to date for the anti-Islamic State coalition.

Thousands of civilians are believed to have fled Raqqa in recent weeks, often with smugglers under the cover of darkness. It is a perilous escape through the city’s narrow streets as the militants dispatch bombers among those fleeing.