After 266 days of fierce battles, the Iraqi armed forces liberated Mosul from the extremist militant Islamic State (ISIS) group ending their three-year rule. Iraqi soldiers and civilians celebrated the historic victory on Sunday in the streets.

Iraqi Prime Minister Haider al-Abadi also visited Mosul to celebrate the victory and congratulate the armed forces, backed by US-led air strikes. The armed forces have been fighting in Mosul, the capital city of Iraq's northern province of Nineveh and the second largest city, since October 17, 2017.

"Victory is certain, and what remains of [IS] is surrounded, and it is just a matter of time for us to announce the great victory to our people," Abadi said in a statement.

"The delay comes out of my respect and support for our... forces who are continuing the clearing operation," he said, adding, "There are only one or two pockets of Daesh remnants left and the major victory is in hand."

The battle between the Iraqi armed forces and the ISIS group has left large areas, including ancient mosques, in ruins, killed thousands of people, and displaced more than 1 million people from Mosul.

Take a look at Mosul's before and after photos below.

Mosul's leaning Al-Hadba minaret
This before and after photo shows (top) a picture taken on June 20, 2017, of Mosul's leaning Al-Hadba Minaret and (bottom) a photo taken on June 22, 2017 of Mosul's skyline missing it's trademark minaret the day after it was blown up by Islamic State (IS) group fighters.MOHAMED EL-SHAHED/AFP/Getty Images
Grand al-Nuri Mosque
This before and after photo shows (top) a picture taken on April 17, 2017, of Al-Nuri mosque in the old city and (bottom) a still image that shows a close up of the destroyed Grand al-Nuri Mosque of Mosul in Iraq, June 21, 2017.Reuters
Mosul
Displaced Iraqis, who fled the Islamic State stronghold of Mosul, ask for food supplies in a distribution point at Khazer camp, Iraq November 23, 2016.Reuters
Mosul
Iraqis gather and dance at the Tahrir Square in the capital Baghdad on July 9, 2017, to celebrate the government's announcement of the 'liberation' of the embattled city of Mosul.SABAH ARAR/AFP/Getty Images
Mosul's clocktower
Smoke billows in the background behind the clock tower of the Church of Our Lady of the Hour (also known as the 'Latin Church') and the minarets of a mosque in the Old City of Mosul on June 30, 2017, as Iraqi government forces continue their offensive to retake the city from Islamic State (IS) group jihadists.AHMAD AL-RUBAYE/AFP/Getty Images
Mosul general view
A general view taken on March 25, 2017, shows the Mosul skyline featuring the minaret and domes of the Great Mosque of Al-Nuri in Mosul, where Islamic State (IS) group leader Abu Bakr al-Baghdadi declared his caliphate back in 2014, as Iraqi forces advance in an offensive to retake the city from IS fighters.AHMAD AL-RUBAYE/AFP/Getty Images
Al-Nuri Mosque
A member Iraqi Counter-Terrorism Service (CTS) walks down a street in front of Al-Nuri Mosque in Mosul's Old City on July 4, 2017, during the ongoing offensive to retake the city from Islamic State (IS) group fighters.AHMAD AL-RUBAYE/AFP/Getty Images