Pushed out from many of its strongholds in Syria and besieged on all sides in the Iraqi city of Mosul, the Islamic State of Iraq and the Levant group (ISIL, also known as ISIS) is losing its territorial base in the very region that once incubated its growth. In May, the US Defense Intelligence Agency estimated that ISIL has lost 65 percent of its land in Iraq and 45 percent in Syria since 2014.

With the group’s presence in the region greatly diminished, questions arise over who will fill the vacuum left by its retreat.

ISIL’s rapid expansion has irrevocably changed the political dynamics governing the region – but in order to know how, one must first understand the conditions that contributed to the group’s rise.

Below, Al Jazeera charts ISIL’s path from its very beginnings to the slow rot of its current decline.

How did ISIL consolidate its power?

Since the 2003 US occupation of Iraq, the Middle East has undergone a roiling period of conflict, rising sectarianism and chaotic regime change. It is in the shadows of this crumbling regional landscape that ISIL first began to metastasize, nourished by the increasing frailty of Arab states in revolt or at war.

Authors, JM Berger and Jessica Stern in, ISIS: The State of Terror, and Fawaz A Gerges in, ISIS: A History, traced the group’s origins to the early-1990s, when a Jordanian man known as Abu Musab al-Zarqawi, a street thug and former prisoner in Jordan, left for Afghanistan to fight as a mujahed against the Soviet occupation.

He arrived in the country too late. The conflict had subsided, but he later returned to Afghanistan from Jordanin 2000 to set up a training camp for fighters with tepid financial support from al-Qaeda.

There, he developed a recruitment network of fighters whose backgrounds often sketched the same lines as his own: Born into poverty, often radicalised in prison, and with low-levels of education and shallow theological knowledge of the Quran.

Zarqawi’s resources were sparse by the time he arrived in a US-occupied Iraq to form a branch of al-Qaeda. Yet mounting sectarian tensions allowed Zarqawi to gain followers and resources for his fanatical organisation.