MOSUL, Iraq -- Fighters with the Islamic State of Iraq and Syria, or ISIS, launched counterattacks Saturday against Iraqi special forces in eastern Mosul, emerging from populated areas deeper in the city to target the troops with mortars and suicide car bombs in clashes that raged late into the night.

Artillery shelling thundered across the city as snipers traded fire from rooftops and civilians emerged from the front lines waving white flags. There were fresh indications that other residents were being held back by the militants to be used as human shields.

The seesawing battle highlights the challenges ahead for Iraqi forces as they press into more densely populated neighborhoods of the country’s second largest city, where they will not be able to rely as much on airstrikes because of the risk of killing civilians.

Get Breaking News Delivered to Your Inbox

“Daesh is in the city center and we must be very careful as our forces advance,” said Maj. Gen. Sami al-Aridi of the Iraqi special forces, using the Arabic acronym for ISIS.

The special forces entered the Gogjali district, on the eastern edge of Mosul, on Tuesday, marking their first major foray into the city itself after more than two weeks of fighting in its rural outskirts.

ISIS fought back Saturday, pushing the special forces from the southern edge of the neighborhood. Both sides fired mortar rounds and automatic weapons, while the Iraqi troops also responded with artillery. Snipers dueled from rooftops in residential areas, where most buildings are just two stories high.

Dozens of civilians emerged from their homes over the course of the day, some carrying white flags. Many civilians traveling with children and elderly relatives said they had to walk more than 6 miles to reach a camp for the displaced.

Just a few miles from the clashes, Iraqi officers coordinating airstrikes with the U.S.-led coalition watched live drone footage showing a team of ISIS fighters regrouping near the front line.

“They’re moving in front of the mosque,” an Iraqi soldier said as he called in an airstrike, which moments later flattened a small building. Civilians moved into the area soon thereafter, and the soldiers said the militants appeared to have corralled them there to prevent further strikes.

“Daesh have continued to hide behind civilians and facilitate harm to them,” said Col. John Dorrian, a spokesman for the U.S.-led coalition, which has been launching airstrikes to aid the Iraqi advance.

He said Iraqi forces and the coalition “developed a plan that is intended to reduce the possibility of civilian casualties and collateral damage.”

But Iraqi Cpt. Naqib Jaff, who was covered in dust after helping to hold positions east of Mosul overnight, said the air support “hasn’t been enough” and that the coalition was only striking suicide car bombs.

He said that in previous operations against ISIS-held towns and cities, civilians would be moved away from the front lines, allowing forces to advance. But he said in Mosul, his men have been ordered to keep families inside their homes.

“We’ve never been in such a situation before. We would be fighting and there would be a family right next to us,” he said.

The government has ordered residents to stay inside, fearing a mass exodus from the city, which is still home to more than 1 million people.

The advance of the Iraqi forces was also slowed by fortifications erected by the extremists in the more than two years since they captured the city. Trenches and berms have turned the streets and alleyways of a neighborhood once named after former Iraqi leader Saddam Hussein into a maze.

Satellite images show rows of concrete barricades, earthen mounds and rubble blocking key routes into the city center. The images, taken Monday by Stratfor, a U.S.-based private intelligence firm, showed that ISIS fighters have cleared terrain and leveled buildings around Mosul airport and a nearby former military base on the west bank of the Tigris.

Mosul is the last major ISIS stronghold in Iraq, and driving the militants out would deal a major blow to their self-styled caliphate stretching into neighboring Syria.

Iraqi forces have made uneven progress since the operation to retake Mosul began on Oct. 17. The territory they have retaken inside Mosul is just a small fraction of the city, which measures more than 9 miles across.

On Saturday, Iraqi forces advanced toward the town of Hamam al-Alil, which lies along the Tigris River about 9 miles from the southern edge of Mosul. Kurdish television channel Rudaw broadcast live footage of Iraqi troops and armored vehicles amassing outside the town as an attack helicopter fired rockets.

Up to 1,600 civilians may have been loaded onto trucks and forcibly relocated from Hamam al-Alil to the ISIS-held town of Tal Afar earlier this week, the U.N. High Commissioner for Human Rights said Friday. It warned that the captive civilians might be taken as far as Syria to be used as human shields. Another 150 families from Hamam al-Alil were moved to Mosul itself, the U.N. said.

Other civilians have embarked on their own harrowing journeys to escape the fighting.

Ghanim Abd fled his home in Gogjali when Iraqi forces entered on Tuesday and found shelter in an abandoned home deeper inside Mosul. The 56-year-old said he and his children and grandchildren made their way down alleys they feared were littered with roadside bombs after the family ran out of food.

On Saturday, after government forces pushed further into the city, they were able to return home, but he said there was no telling how long they would be able to stay.

“The battle is so harsh, we don’t know where to go next.”