BAGHDAD (AFP) - Iraqi Prime Minister Haider al-Abadi declared victory Sunday (July 9) in the "liberated" city of Mosul, the Islamic State in Iraq and Syria's (ISIS) last urban stronghold in Iraq, as the group's Syria bastion Raqqa is surrounded.
Here are key dates in the group's history and its battle for Mosul:
April 9, 2013: Al-Qaeda in Iraq chief Abu Bakr al-Baghdadi says Al-Nusra Front, an extremist group battling the Syrian regime, belongs to his Islamic State of Iraq and the Levant (ISIL) and is fighting for an Islamic state in Syria.
A day later, Al-Nusra pledges allegiance to Al-Qaeda chief Ayman al-Zawahiri, distancing itself from Baghdadi. In early 2014 Al-Qaeda disavows ISIL completely.
Syria's Raqqa falls
Jan 14, 2014: ISIL conquers Raqqa city in northern Syria after fierce fighting with rival rebels. Raqqa, the first provincial capital to fall entirely from regime hands, becomes the jihadists' Syrian stronghold.
Iraq's Mosul captured
June 10, 2014: ISIL launches a lightning offensive in north-western Iraq, seizing second city Mosul and sweeping across Sunni Arab areas bordering the autonomous Kurdistan region. Tens of thousands of Christians and Yazidis flee.
June 29, 2014: ISIL declares a "caliphate" in territories it has seized in Iraq and Syria.
It rebrands itself the Islamic State in Iraq and Syria (ISIS) and declares its chief Baghdadi "caliph" and "leader for Muslims everywhere".
Aug 8, 2014: US warplanes strike ISIS positions in northern Iraq in response to an appeal from the Iraqi government. In September an international coalition is formed to defeat the group.
Sept 23, 2014: The US and Arab allies launch air strikes on ISIS in Syria.
ISIS losses in Iraq
March 31, 2015: Iraq announces the "liberation" of Tikrit, 160km north of Baghdad. ISIS had controlled Tikrit for nearly 10 months.
Feb 9, 2016: Sunni-majority Ramadi, capital of Anbar province, is recaptured from the jihadists, who had overrun it the previous May.
June 26, 2016: Iraqi forces recapture Fallujah after two and a half years beyond government control.
ISIS defeats in Syria
Jan 26, 2015: ISIS is driven out of the Syrian border town of Kobane after more than four months of fighting led by Kurdish forces backed by coalition air strikes.
Aug 6, 2016: The Syrian Democratic Forces coalition of Arab and Kurdish fighters backed by US air strikes recaptures the northern Syrian town of Manbij.
Aug 24, 2016: Turkish troops and Syrian rebels retake the border town of Jarabulus, during Operation Euphrates Shield, which also targets Kurdish militia.
Feb 24, 2017: The Turkish army announces that it has taken full control of the northern town of Al-Bab, the ISIS last bastion in Aleppo province.
March 2, 3017: Syrian troops backed by Russian jets complete the recapture of the historic city of Palmyra from ISIS. The city had previously changed hands several times.
The battle for Mosul
Oct 17, 2016: Some 30,000 Iraqi forces backed by US-led air support launch a vast operation to retake Mosul.
Three months later they retake the east side of the city and turn their attention to the west.
June 29, 2017: Iraq announces it has recaptured the iconic Nuri mosque in Mosul's Old City. The Iraqi premier calls it a sign of IS's impending defeat.
June 30, 2017: A senior Iraqi commander says Iraq will declare the liberation of Mosul in the "next few days." July 9: Abadi declares victory in the "liberated" city of Mosul after days of fierce fighting during which Iraqi forces battled to retake the last two IS-held areas near the Tigris River.
The battle for Raqqa
Nov 5, 2016: The SDF launches an operation to capture Raqqa.
June 6, 2017: The SDF enters Raqqa, seizing a quarter of the city and cutting off the last ISIS escape route by the end of the month.
July 2, 2017: SDF fighters pierce Raqqa from the south for the first time.
July 4, 2017: US Central Command says SDF forces have penetrated the wall surrounding Raqqa's Old City where a few hundred die-hard militants are making a last stand.
Key dates in the Mosul offensive:
The battle begins
Oct 17, 2016: Iraqi forces launch the assault to recapture Iraq's second city, conquered by ISIS in June 2014. A month later the extremist group's supremo Abu Bakr al-Baghdadi made his only public appearance in Mosul, to urge Muslims worldwide to move to the recently proclaimed "caliphate" straddling Iraq and Syria.
Tens of thousands of army, police and counter-terrorism troops are thrown into the long-awaited offensive with crucial support from a US-led coalition.
In two weeks dozens of surrounding localities are recaptured, including the Christian town of Qaraqosh around 15km from Mosul.
Nov 1, 2016: The army says it has entered Mosul city for the first time since 2014.
Nov 3, 2016: Baghdadi breaks a year-long silence, urging followers to fight to the death for Mosul.
Nov 8, 2016: Iraqi Kurdish peshmerga fighters say they have reached Bashiqa, a dozen kilometres north of Mosul.
Nov 13, 2016: Iraq says it has recaptured Nimrud, an ancient city southeast of Mosul.
Nov 23, 2016: Shi'ite-dominated paramilitary units known as the Hashed al-Shaabi say they have cut ISIS supply lines between Mosul and the extremists' Syrian stronghold Raqa, 400 kilometres to the west.
The Iraqi forces face strong resistance from the extremists who carry out numerous suicide attacks.
East Mosul retaken
Dec 29, 2016: Government troops end a two-week pause and launch the second phase of their assault on east Mosul.
Jan 8, 2016: Iraqi units reach the Tigris River that divides Mosul and take up positions near one of the city's five bridges, all now destroyed.
Jan 24, 2017: The Joint Operations Command coordinating the fight says the east has been "fully liberated".
Battle for west begins
Feb 19, 2017: Abadi announces the start of the battle for west Mosul, with Iraqi forces backed by coalition air power and support from coalition advisers.
Feb 24, 2017: Iraqi forces seize full control of Mosul airport and enter their first west Mosul neighbourhood.
March 12, 2017: A US envoy says Iraqi troops have cut all roads into western Mosul, trapping remaining IS fighters inside.
March 14, 2017: Iraqi forces say they have captured the city's train station after reaching other symbolic sites such as the regional government headquarters and the city's museum.
May 4, 2017: Iraqi forces launch a second front in north-western Mosul to further seal the siege on the Old City. Aid groups say extremists are holding tens of thousands of civilians as human shields.
May 16, 2017: A military spokesman says almost 90 per cent of west Mosul has been recaptured.
The United Nations says that hundreds of thousands of Iraqis have fled Mosul over the past seven months.
June 18, 2017: Iraqi forces, backed by coalition air strikes, launch an assault to retake the Old City, where remaining IS fighters are entrenched.
June 21, 2017: ISIS fighters blow up Mosul's iconic leaning minaret and the adjacent mosque where Baghdadi made his only public appearance.
A week later, troops retake the mosque ruins which Abadi hails as a sign of ISIS's impending defeat. Iraqi forces battle the last few hundred militants in Mosul's historic centre.
July 9, 2017: Abadi declares victory in the "liberated" city during a visit to Mosul, his office says.
This marks an epic milestone for the Iraqi security forces, who had crumbled in the face of an ISIS onslaught across Iraqi in 2014.
In the final days of the battle, the fight grew tougher as Iraqi forces fought to retake the last two ISIS-held areas near the Tigris River.