MOSUL, Iraq — Hundreds of civilians fled Mosul’s Old City on Friday as Iraqi forces slowly squeezed the last pockets of Islamic State resistance, and the U.N. warned that the “intense and concentrated” fighting put innocent lives in even greater danger.

People climbed over mounds of rubble and through narrow alleys as gunshots and explosions rang out nearby. The neighborhoods where government forces are fighting have been under siege for months as grueling urban warfare drew out the operation to retake Iraq’s second-largest city.

For the civilians held as human shields by the extremists, supplies have run low and drinking water is scarce, according to residents at screening centers and clinics.

The battles came a day after Iraqi forces made significant gains against the militants and Prime Minister Haider al-Abadi declared an end to the group’s self-proclaimed caliphate.

After a dawn push Thursday, Iraqi forces retook the symbolic site where the al-Nuri Mosque once stood. It was from the pulpit of the 12th century mosque, which the militants blew up last week along with its famous leaning minaret, that their leader Abu Bakr al-Baghdadi had proclaimed the caliphate in 2014.

During the evening, al-Abadi announced that the full liberation of Mosul was near and that Iraq’s “brave forces will bring victory.”

Lt. Gen. Abdul Wahab al-Saadi said that by Friday afternoon, the special forces were within about 760 yards of the Tigris River, which roughly divides Mosul into eastern and western halves.

The operation to retake Mosul, backed closely by the U.S.-led coalition, began in October, with the Iraqi government initially vowing the city would be liberated in 2016.

The Islamic State now holds a small patch of territory in Mosul’s Old City along the Tigris that measures less than a square mile. The terrain is dense, and the U.N. estimates tens of thousands of civilians are trapped there.