The jihadists seized it in a lightning offensive in June 2014 that humiliated Iraq's security forces, who launched their massive operation to retake it in October last year.
Here are some facts about Mosul:
The Mosul area is rich in oil and the city straddles the Tigris River about 350 kilometres (220 miles) north of Baghdad, and 50 kilometres (30 miles) south of Iraq's biggest dam.
It has long been a trading hub between Iraq, Syria and Turkey, and its population was once a mosaic of Arabs, Kurds, Turkmen, Christians and other minorities.
Muslin, the fine cotton fabric that is one of the city's best-known products, derives its name from "Mosul".
The city controls key supply routes in northern Iraq, notably a highway to the border with Syria and its second city of Aleppo.
Mosul's population, which has fallen from a peak of around two million, now comprises mostly Sunni Arabs, and after Saddam Hussein was defeated the jihadist group Al-Qaeda took root there.
On June 10, 2014, fighters from the Islamic State in Iraq and the Levant (ISIL) seized the city, and on June 29, ISIL leader Abu Bakr al-Baghdadi proclaimed an Islamic "caliphate" that included Mosul, the Syrian city of Raqa and large patches of territory in Iraq and Syria.
He named it the Islamic State, and made his first public appearance on July 5 at Mosul's famed Great Mosque of al-Nuri.
IS militants turned the city into an urban model for their state, setting school programmes, operating hours for shops and dress codes. The sale of alcohol and cigarettes was forbidden.
Signup to our newsletter and follow us on Facebook and Twitter!
The city's historic centre was dotted with church spires, and it was home to an estimated 35,000 Christians when IS arrived. Christians were ordered to convert, pay a special tax, or leave, and almost all fled.
Starting in July 2014, IS began to destroy Shiite Muslim mosques and sanctuaries, some of which had been richly adorned and stood for centuries.
Militants burned thousands of rare books and manuscripts in the city's vast museum and smashed priceless statues.
IS rigged the Nabi Yunus shrine -- revered by both Muslims and Christians as the tomb of Prophet Jonah -- with explosives and blew it up. It also destroyed the Prophet Seth shrine.
The extent of the damage to the archaeological site where the Nineveh ruins lie in east Mosul is not yet clear.
The Old City of Mosul, on the western side of the river, is also considered of major cultural value. On June 21, as Iraqi forces advanced in the Old City, the jihadists blew up the Nuri mosque and Mosul's iconic leaning minaret, known as the "Hadba" (Hunchback), which had been a symbol of the city for centuries.
Mosul was conquered by Arabs in 641 and reached its cultural peak in the 12th century before falling to Mongols in 1262, and then to Persians and Ottomans.
The city became part of Iraq when the country was created out of the ashes of the Ottoman Empire in the 1920s.
Britain annexed the oil-rich region in 1918, to the dismay of France which sought to attach it to Syria, under a French mandate.
Nineveh has always been a border region, keenly contested by its rival communities and their powerful supporters in neighbouring states.
In the early years of this century, Mosul proved a bastion of Saddam's most dedicated supporters who became a foundation of IS, and extortion and protection rackets in the city were a major source of jihadist funding before it was overrun.