
IRBIL, Iraq — As Iraqi forces advanced toward al-Salam hospital in Mosul this week, encountering only light resistance from Islamic State fighters, commanders decided to seize the facility instead of sweeping the neighborhoods along the road leading to it.
A few hours later, as the sun set Tuesday evening, the trap was sprung. First came suicide car bombs, and then the hospital was surrounded by hundreds of militants firing bursts of heavy machine gun fire and rocket-propelled grenades.
‘‘We thought we were going to die, all we could think about was saving our lives,’’ Private Mithad Abdulzahra of the Iraqi army’s Ninth Division said later, as he recovered in a hospital bed in the nearby city of Irbil from gunshots that shattered his right arm. The Islamic State fighters eventually fought their way inside al-Salam hospital. Of the 100 or so Iraqi soldiers trapped there, nearly all were killed or wounded, he said.
Seven weeks into the Iraqi operation to retake Mosul, Islamic State fighters are still contesting every block of Iraq’s second largest city, and the battle will likely continue well into next year. The battle for al-Salam hospital highlights the challenges Iraqi forces face as they move deeper into the city.
‘‘Every time we would fight off one unit of IS fighters, another would appear,’’ said Colonel Haider Hatem, who was wounded early on by a sniper’s bullet. He said he called in US-led airstrikes but was told the Islamic State fighters were so close that hitting them from the air would endanger his forces.
Over the next 24 hours, the Ismalic State fighters unleashed 15 suicide car bombs.
On Wednesday morning, Iraqi special forces were pulled away from another front in eastern Mosul and tasked with launching a rescue mission. The elite force has served as the tip of the spear in the Mosul offensive, but has also taken heavy losses. The special forces eventually fought their way to the hospital, opening up a route of retreat for the embattled soldiers of the Ninth Division.
‘‘When we reached them, they barely had any bullets left,’’ a special forces officer said.
As Iraqi forces retreated, US-led warplanes hit the hospital and the abandoned Iraqi army vehicles.
Colonel John Dorrian, a coalition spokesman, said the strike was carried out at the request of Iraqi ground forces and the hospital was hit because Islamic State fighters were using it to fire down on Iraqi troops.
In all, more than 20 Iraqi soldiers were killed in the battle, and a handful of armored Iraqi vehicles were captured by militants, the special forces officer said. An Islamic State video posted online Thursday showed what appeared to be about a dozen destroyed Iraqi army vehicles near al-Salam hospital. The video could not be independently verified.
The battle for the Mosul is the biggest operation Iraq has carried out since the 2003 US-led invasion, and comes just two years after Iraqi forces crumbled in the face of the lightning Islamic State advance in the summer of 2014.
Iraqi forces have retaken a number of cities and towns over the past year, but few units have experience in urban combat. The Ninth Division is an armored force, designed for conventional battles against other armies on open terrain. Iraq’s special forces are better equipped for the street battles in Mosul, but there aren’t enough of them to retake the city on their own.