In dramatic footage provided by volunteer aid group Free Burma Rangers, Dave Eubank is seen rescuing a young child from ISIS gunshots in Mosul, Iraq. The rescue was part of a rescue effort following a mass attack by ISIS on June 2, 2017. (Published Thursday, June 22, 2017)

Despite clinging to only a sliver of territory in Mosul, Islamic State militants managed to launch a counterattack Friday that reversed days of Iraqi army territorial gains in just a matter of hours — a setback that underscores the fragility of the Iraqi security forces despite years of U.S.-led coalition training as well as the instability likely to follow the city's liberation.

The offensive began just after noon, when 50 to 100 ISIS fighters began firing on units of the Iraqi army's 16th Division charged with holding the northwest frontline in the Mosul's Old City neighborhood. The attack broke through the army's first line of defense and the rest of its lines soon crumbled.

The surprise attack illustrated the resilience of the extremists who, though controlling less than a square kilometer of territory, have maintained the ability to conduct both conventional military counterattacks and insurgent strikes.

Hassan, a 45-year-old soldier with the 16th Division, described the close-fought battle inside the rubble-strewn alleyways of the Old City.

"Daesh started to attack us from everywhere. We were so close to them that we even fought with hand grenades," he said referring to ISIS by its Arabic acronym.

"We have lots of martyrs and wounded soldiers, but we can't evacuate them. It was epic," Hassan said, giving only his first name in line with military regulations.

The initial wave of Iraqi army casualties began arriving within an hour at a field hospital a few hundred meters (yards) from the front, carried on stretchers by medics on foot through the Old City's perilous terrain.

The neighborhood's narrow roads, once passable on motorcycles, are now covered with rubble and downed power-lines, and the footpaths that lead in and out of the Old City wind through houses, across rooftops, beside airstrike craters and down into basements.

At least five soldiers were killed and 25 wounded, said a doctor at the field hospital. The Iraqi military was forced to pull back about 75 meters (80 yards), behind a row of buildings along one of the Old City's few main roads, said an Iraqi officer overseeing the Mosul operation who spoke on condition of anonymity in line with regulations.

Similar ISIS counterattacks over the past month point to the difficult road ahead.

In late June, some 200 ISIS soldiers dressed in fatigues that resembled the Iraqi military's Shiite militia allies launched an offensive on two neighborhoods along Mosul's western edge. Iraqi army units crumbled and Iraq's special forces had to be dispatched to the area along with coalition surveillance and air support. The reallocation of resources stalled the Old City push, then in its early days.

In mid-June more than 100 ISIS fighters launched a large-scale counterattack from the Old City's southern front on Federal Police units stationed there, killing 11, seizing armored vehicles and weapons.

Meanwhile, south of Mosul, ISIS has successfully retaken a pocket of territory declared liberated months ago.

"The attack started two days ago. Daesh took Imam Gharbi village," said Salah Hassan Hamid, the mayor of Qaryara, a nearby town. He said policemen and tribesmen allied with the Iraqi military were sent in, but clashes were still ongoing and only half the village had been brought back under government control.

Two Iraqi journalists were killed and ISIS took a number of local residents hostage, the mayor added.

Despite the setbacks, coalition spokesman U.S. Army Col. Ryan Dillon said the counterattacks were costing ISIS large numbers of fighters and not having an impact on the overall operation to defeat the militant group.

Once Mosul is liberated, Dillon said, Iraqi security forces "can completely focus on not just a conventional fight but also on security and holding that ground."

However, Patrick Martin of the Institute for the Study of War, a Washington-based research group, said the ISIS offensives show the security forces allocated to Mosul once Iraq's special forces and police leave are inadequate.