(Sarah Parnass,Jesse Mesner-Hage/The Washington Post)

Iraq’s prime minister announced that government forces had recaptured the city of Mosul on Monday, signaling an end to a grueling nine-month battle to dislodge Islamic State militants from one of their most important strongholds.

“From the heart of the liberated city of Mosul with the sacrifices of Iraqis from all the provinces, we announce the major victory for all Iraq and Iraqis,” said Haider al-Abadi, standing in front of a bank of commanders and Humvees.

Three years ago, Mosul’s security forces collapsed in the face of the Islamic State’s advance, and the city became famous as the site where the group’s leader, Abu Bakr al-Baghdadi, declared the establishment of a “caliphate” spanning swaths of Syria and Iraq.

This week, it became the city where the Islamic State’s territorial pretensions have crumbled. Although the group is likely to hang on to the core of its proto-state for months to come, the military tide appears to be turning in favor of a U.S.-led coalition of forces fighting the group in both countries.

U.S. Secretary of State Rex Tillerson described the announcement Monday as a “critical milestone” in the world’s fight against the Islamic State.

Members of the Iraqi federal police forces celebrate in Mosul after the government's announcement of the “liberation” of the embattled city from the Islamic State. (Fadel Senna/Agence France-Presse via Getty Images)

The battle to recapture Mosul was the deadliest and most difficult in the ongoing coordinated campaign against the extremist group.

Half the city’s population has been displaced, and thousands of civilians are believed to have been killed. Western districts have been pummeled by coalition airstrikes, Islamic State suicide bombs and shelling. Newly retaken areas resemble a gray sea of rubble.

The Islamic State’s victory in Mosul shifted the balance of power among Iraq’s security forces, empowering a set of Iranian-backed militias who are now sanctioned by the central government, and bringing U.S. ground troops back into Iraq for the first time since 2011. 

Abadi had begun his victory tour of the city Sunday, congratulating commanders as the counterterrorism troops cleared the final pockets of Islamic State resistance. As he spoke Sunday night, it appeared that fighting was continuing between Iraq’s regular army and the militants in the final sliver of contested territory.

The Iraqi air force said Monday that it had dropped three million leaflets over the city, proclaiming victory against the Islamic State. In Mosul’s al-Manassa neighborhood, a stage used by the militants to announce military victories elsewhere in Iraq was repurposed for celebrations Monday. In Baghdad, residents also flooded into central squares to mark the militants’ near-defeat in Mosul.

“This was the toughest battle we ever fought,” said Lt. Gen Sami Al-Aridhi, the commander of Iraq’s elite forces. “An enemy we fought in the streets and the alleyways, this is the time we have signaled their demise.”