MOSUL/ERBIL, Iraq (Reuters) - Islamic State militants vowed to “fight to the death” in Mosul on Saturday as Iraqi military commanders said they would take full control of the city from the insurgents at any moment.

Dozens of Iraqi soldiers celebrated amid the rubble on the banks of the Tigris river without waiting for a formal victory declaration, some dancing to music blaring out from a truck and firing machineguns into the air, a Reuters correspondent said.

The mood was less festive, however, among some of the nearly one million Mosul residents displaced by months of combat, many of whom are living in camps outside the city with little respite from the blazing summer heat.

“If there is no rebuilding and people don’t return to their homes and regain their belongings, what is the meaning of liberation?” Mohammed Haji Ahmed, 43, a clothing trader, told Reuters in the Hassan Sham camp to the east of Mosul.

Earlier on Saturday, a military spokesman said the insurgents’ defense lines were collapsing, state television reported.

“We are seeing now the last meters (yards) and then final victory will be announced,” a presenter said, citing correspondents embedded with security forces fighting in Islamic State’s redoubt in the Old City by the Tigris.

“It’s a matter of hours,” she added.

But Islamic State’s Amaq news agency reported “fierce fighting” around the riverside district of Maydan and said its fighters “were holding onto their fortified positions.”

“The fighters of Islamic State are collectively pledging (to fight to the) death in Maydan,” Amaq said in another online post.

Artillery explosions and gunfire could still be heard during Saturday afternoon and a column of smoke billowed over the Old City riverside, the Reuters correspondent said.

A U.S.-led international coalition is providing air and ground support to the eight-month campaign to wrest back Mosul, by far the largest city seized by Islamic State (IS) in 2014.

Almost exactly three years ago, the ultra-hardline group’s leader Abu Bakr al-Baghdadi declared from Mosul a “caliphate” over adjoining parts of Iraq and Syria.

‘FIGHTING FOR EVERY METER’

Slideshow ( 10 images )

Dozens of IS insurgents were killed on Saturday and others tried to escape by swimming across Tigris, state TV said. Most of those making a last stand were foreigners, it added.

Iraqi commanders say the militants were fighting for every meter with snipers, grenades and suicide bombers, forcing security forces to fight house-to-house in the densely populated maze of narrow alleyways.

“The battle has reached the phase of chasing the insurgents in remaining blocks,” the Iraqi military media office said in a statement. “Some members of Daesh have surrendered,” it added, using an Arab acronym of Islamic State.

Slideshow ( 10 images )

The road where the soldiers celebrated was scarred with gaping holes from explosions and rubble from a flattened multi-storey shopping mall.

Rubbish and ammunition boxes were strewn around and the only civilians seen were a group of about 15 women, children and elderly, some of them wounded, sheltering in a damaged petrol station. Security forces medics were giving them first aid.

Months of urban warfare has displaced 900,000 people, about half the city’s pre-war population, and killed thousands, according to aid organizations.

Prime Minister Haider al-Abadi declared the end of Islamic State’s “state of falsehood” a week ago, after security forces took Mosul’s medieval Grand al-Nuri mosque - although only after retreating militants blew it up.

Stripped of Mosul, Islamic State’s dominion in Iraq will be reduced to mainly rural, desert areas west and south of the city where tens of thousands of people live. The militants are expected to keep up attacks on selected targets across Iraq.

The United Nations predicts it will cost more than $1 billion to repair basic infrastructure in Mosul. In some of the worst-affected areas, almost no buildings appear to have escaped damage and Mosul’s dense construction means the extent of the devastation might be underestimated, U.N. officials said.

The fall of Mosul also exposes ethnic and sectarian fractures between Arabs and Kurds over disputed territories or between Sunnis and the Shi’ite majority that have plagued Iraq for more than a decade..

During their impromptu victory celebrations, some of the Iraqi soldiers waved pictures of Hussein, the grand son of prophet Mohammed who is immensely revered by the Shi’ites.

Mosul is a majority Sunni city who has long complained of being marginalized by the Shi’ite-led governments installed after the 2003 U.S.-led invasion of Iraq.

Meanwhile, Iraq’s regional Kurdish leader said this week that the government in Baghdad had failed to prepare a post-battle political, security and governance plan.