(Reuters) -- Iraqi government forces besieged Islamic State militants around Mosul's Old City on Thursday, edging closer to the historic mosque from where the group's leader declared a caliphate nearly three years ago.
The militants, holed up in houses and darting through alleyways, resisted with sniper fire, suicide attacks and car bombs.
Though heavy rain hampered the advance, Federal Police and rapid response unit troops reached points about 500 m (yards) from the centuries-old al-Nuri Mosque by Thursday morning.
The black jihadist flag was clearly visible draped from its famous leaning minaret.
The government forces have made significant gains in recent days in a battle that started in October, seizing a main bridge over the Tigris river and closing in on the mosque.
"We are holding positions we took yesterday. There is a lot of resistance in that area with snipers and car bombs," Federal Police Major General Haider Dhirgham told Reuters.
The capture of al-Nuri Mosque would be a huge symbolic victory as well as a concrete gain.
"It's important for them, it's where they declared their state," Dhirgham said, speaking at a police forward base as refugees trudged through the muddy streets and wrecked houses.
Islamic State leader Abu Bakr al-Baghdadi chose the mosque as his backdrop for announcing the caliphate spanning Iraq and Syria in July 2014.
Since then, Mosul has been the hardline group's main urban stronghold in Iraq but it has steadily lost ground since the offensive began. Iraqi leaders say the battle is reaching its final stages.
Several more areas of western Mosul had been recaptured, including the hospital, during Wednesday and Thursday morning but officers said progress was slowed by car bombs and booby-traps in houses and alleyways, as well as the bad weather.
Islamic State hit back with sporadic attacks on government positions, including mortar fire. Suicide bombers had driven explosive-rigged cars at troops, Dhirgham said.
Government forces responded with mortars and helicopter gunships strafed militant positions from above.
Police said they had killed nine militants who tried to counter-attack one of their positions with rocket-propelled grenades.
"Federal Police drones bomb dozens of fixed and mobile Daesh targets in the perimeters of the Grand Mosque," a later police statement said, using an Arab acronym for Islamic State.
A Federal Police officer said commanders were meeting to adjust their plans for tackling the Old City.
"The new offensive plans should adapt with the difficult terrain of the complicated, narrow alleys," he said. "The tight roads prevent us from using armored vehicles and that will definitely leave our soldiers vulnerable to enemy fire."
The need to ensure the safety of civilians, many of them hungry and traumatized by living under Islamic State's harsh rule, was also a priority.
"The enemy ... has started to set fire to houses, which means that are on the retreat. They have destroyed homes and have destroyed families," Dhirgham said.
Mosul has served as Islamic State's de facto capital as they imposed the rule over the areas they had seized. The city's recapture by the government would drive the remnants of the Islamic State army into the hinterlands.
The group is also under pressure in neighboring Syria, where three separate forces are advancing on Raqqa, the main Syrian city under Islamic State control.
As well as waging jihad in Iraq and Syria, the militants have inspired attacks in cities in Europe, Africa and elsewhere that have killed hundreds of civilians.
U.S. and other Western countries are providing air, artillery and other support to the Mosul offensive, reflecting the international concern over the Islamic State threat.
However, the presence of tens of thousands of civilians in IS-held areas means that simply pulverizing them is a risky proposition.
Thousands of residents have escaped to government lines in recent days but it has been impossible to tally the number of civilian casualties.
On Thursday, at a camp crammed to capacity south of Mosul, displaced families from the Old City waited for buses to take them on to other areas.
Many had come from near a central bus garage on the western side of old Mosul and had fled that morning.
"There's destruction, houses destroyed, people have been pulled from under the rubble," said Hisham Sobhi, 41, waiting with his family in the rain and mud.
Some were heading to eastern Mosul to stay with relatives. Taxi drivers shouted 'Mosul, Mosul!" -- meaning the eastern side.
Major General Dhirgham said the total retaking of the city was not yet imminent.
"I will not tell you one or two weeks, because that's not true, but within one or two months it will be completely liberated," he said.
Additional reporting by Ahmed Rasheed in Baghdad; Writing by Angus MacSwan in Erbil; Editing by Tom Heneghan.