Map shows the important places that ISIS still controls as of November.

But in 2017, the Islamic State’s losses drastically accelerated, and the militants are now returning to their insurgent roots.

Map shows important places that ISIS has captured in the last four years.

Over three years, the group achieved military dominance in critical places in almost every province in Syria and across northern and central Iraq.

The militant group shocked the world in June 2014 as it seized control of more than 50 places, including Mosul, Iraq’s second-largest city.

The Islamic State grew out of an insurgency in Iraq and was affiliated with Al Qaeda until 2014. By that time, ISIS had established a foothold in Iraq and Syria.

Map shows strategic cities, towns and resources that the Islamic State has controlled in the last four years. The size of each square is proportional to the approximate area of each place.

The Islamic State carved out a sprawling territory across Iraq and Syria through military dominance over 127 important places. The group governed the residents of dozens of cities and towns, and it benefited from their taxes. The militants also had control over strategic locations, like military bases and border crossings, as well as economic assets, like oil fields and dams.

How Places Compare by Size New York City Baghdad Damascus Mosul Raqqa New York City Baghdad Damascus Mosul Raqqa New York City Baghdad Damascus Mosul Raqqa The New York Times

In October, United States-backed forces pushed the Islamic State out of Raqqa, the group’s de facto capital, dealing a heavy blow to the militants.

The offensive began in June and left widespread destruction, displacing about 270,000 residents. United States-led coalition airstrikes there were “reportedly killing hundreds of trapped civilians every month,” wrote Samuel Oakford in a report for Airwars, a nonprofit group that tracks reports of civilian deaths in Iraq and Syria. According to the report, the coalition has confirmed four civilian deaths in the battle for Raqqa.

Destruction Over Time in Raqqa June 2017 June 2017 June 2017 July 2017 July 2017 July 2017 July 2017 July 2017 July 2017 August 2017 August 2017 August 2017 August 2017 August 2017 August 2017 August 2017 September 2017 September 2017 September 2017 September 2017 September 2017 September 2017 October 2017 A series of satellite images from June to October this year shows the growing number of neighborhoods across Raqqa, Syria, that have sustained serious damage. Source: European Space Agency

In four months, the Islamic State lost not only Raqqa, but two more of its most important cities.

In July of this year, the Iraqi government announced that it had finally retaken control of Mosul after three years of Islamic State rule and a brutal nine-month battle. Iraqi forces faced stiff resistance from Islamic State militants there, often in dense urban areas that were difficult to navigate. Much of the city was destroyed.

The Maydan area of Mosul’s Old City, where the last Islamic State militants were corralled and eventually killed by Iraqi security forces. Ivor Prickett for The New York Times

Mosul held huge symbolic value for the group. It was there, in June of 2014, that Abu Bakr al-Baghdadi, the leader of the Islamic State, declared a caliphate after his fighters took control of Mosul and swept through other parts of northern Iraq and Syria, seizing dozens of cities.

A still image taken from video of a man said to be Abu Bakr al-Baghdadi, the leader of the Islamic State, in what would have been his first public appearance in Mosul. Reuters

The Islamic State’s remaining strongholds in Iraq fell quickly after Mosul was retaken. Tal Afar, near Mosul, was captured by Iraqi forces in an offensive that lasted just 11 days. And in October, the militants barely put up a fight in Hawija.

The last remaining area of Islamic State control in Iraq is a sliver along the Euphrates River that stretches across the border into Syria. But the Iraqi military said on Friday that it had seized Qaim, a town on the Iraqi side of the group’s last border crossing.

June 2014: 52 Number of key places the Islamic State has gained or lost control of in each month Gains 2014 2015 2016 2017 Losses March 2017: 9 June 2014: 52 Number of key places the Islamic State has gained or lost control of in each month Gains 2014 2015 2016 2017 Losses March 2017: 9 June 2014: 52 Number of key places the Islamic State has gained or lost control of in each month Gains 2014 2015 2016 2017 Losses March 2017: 9 The New York Times | Source: Conflict Monitor by IHS Markit. Note: Control indicates the militants’ military dominance over a place. Some places shown as controlled by the Islamic State in Jan. 2014 may have fallen under its control at an earlier date.

Downstream of Raqqa, the militants lost the last of their control in Deir al-Zour, the capital of a resource-rich province by the same name. The Syrian government broke a nearly three-year siege by the militants of a government-held pocket of territory in Deir al-Zour in September, and it announced on Friday it had taken full control of the city.

Syrian government forces, backed by Russia and Iran, have also seized Mayadin, where coalition officials believed many of the Islamic State’s leaders had relocated from Raqqa.

Mosul Raqqa Aleppo ISIS control Oct. 26, 2015 Deir al-Zour IRAQ Mayadin SYRIA Qaim Baghdad ISIS control Oct. 30, 2017 Damascus Mosul Raqqa Aleppo IRAQ Deir al-Zour ISIS control Oct. 26, 2015 SYRIA Damascus ISIS control Oct. 30, 2017 Baghdad The New York Times | Source: Conflict Monitor by IHS Markit

Despite these dramatic losses, analysts say that the Islamic State is not defeated. An estimated 6,000 to 10,000 militants remain in Iraq and Syria.

The Islamic State has been shifting tactics and returning to its insurgent roots. Analysts say it will continue to have some local support and the ability to lodge attacks throughout the region.

“The networks will survive and the insurgency will continue in these areas, probably under a different brand,” says Columb Strack, a principal analyst at IHS Markit.