When the Islamic State raised its black flag over the Syrian city of Raqqa in early 2014, it began its transformation from fringe regional player to fearsome global threat. By the end of that year, it had seized large stretches of territory in Iraq and Syria, creating a rogue state the size of Britain.

Now, the last of that territory — a sliver of land along the Euphrates River in southeastern Syria — has been retaken. Thousands of fighters remain in the region, but they have gone underground, carrying out quick strikes in the region and continuing to promote their ideology worldwide.

Here are some of the major moments in the group’s evolution:

A fringe group rises to major player.

The Islamic State traces its roots to Al Qaeda in Iraq, an offshoot of the terrorist group that attacked the United States on Sept. 11, 2001. The Iraqi affiliate started an insurgency that pushed Iraq to the brink of civil war in 2006 and 2007, before it suffered defeat at the hands of American troops and local militias.

By 2013, remnants of the Qaeda affiliate had rebranded themselves the Islamic State of Iraq and Syria, or ISIS, and had identified opportunities in Syria, which was in the third year of its civil war. The Islamic State leader, Abu Bakr al-Baghdadi, an Iraqi, was the architect of the group’s push to seize territory and declare its own state.