MOSUL, Iraq, March 9 (Reuters) - Mohammed Fathi sat calmly on a plastic chair, twiddling his prayer beads as machine gun fire erupted from a neighbor's house, incoming bullets crackled overhead and helicopters strafed targets nearby in western Mosul.
The 70-year-old grandfather of 10 looked relieved. The day before, death had come much closer.
He described how Islamic State fighters had used the top floor of his home to fire sniper rifles and BKC machine guns at advancing Iraqi forces, while Fathi's family and others displaced by the violence cowered downstairs.
If the militants had held out a few minutes longer, an air raid would have brought the building down on top of them.
"Thank God, they retreated from here and troops arrived to find just us.
"One of the soldiers told us they were five minutes away from calling in an air strike because of the resistance coming from our house," he said.
Fathi, wearing a red and white headdress, hobbled around his home pointing at damage the Islamic State fighters had done to his property - a children's cupboard smashed up to use as barricades and to rest rifles on, a basket upturned to stand on while they fired at the enemy.
The fighters, some of whom spoke Russian, left their posts in the upstairs bedrooms and retreated through the next-door house via holes they had knocked through the walls, Fathi said.
"As the soldiers arrived, we weren't sure if Daesh (Islamic State) were still there. My son went up to check, and they'd gone."
The Iraqi Counter Terrorism Service (CTS) entered the home around sunset on Monday, and on Tuesday were stationed outside in armored vehicles, or firing from adjacent buildings at Islamic State positions along the shifting front line.
Fighting to drive Islamic State from western Mosul, its last major stronghold in Iraq, has involved close-quarter street battles, with Iraqi forces advancing block by block as they approach the most densely populated parts of the city.
Fathi's home is one of many that Islamic State fighters have used as battle positions as they withdraw towards the city center, taking cover among the 750,000 civilians in western Mosul.
U.S.-backed Iraqi forces recaptured eastern Mosul in January, and attacked districts west of the river Tigris on Feb. 19. Advances have sometimes slowed to try to avoid civilian casualties, while Islamic State has used suicide car bombs and snipers.
"Daesh are retreating house by house, and they're also using tunnels they've dug to escape," said CTS Corporal Marwan Hashem, stationed in the house next door to Fathi.
"They take up rooftop positions on homes to shoot."
CTS troops and Federal Police units that joined them later on Tuesday were using holes the militants had knocked through to move back and forth, and huddled in a courtyard as they planned their next attack.
Members of Hashem's unit said they were confident the Mansour district would be recaptured from Islamic State in a matter of hours. But the militants were putting up stiff resistance.
A CTS gunner standing casually in a doorway overlooking the front line winced and quickly stepped back as a rocket hit a nearby building.
The faint stinging smell of gas pervaded the air for a few minutes, and Hashem placed a surgical mask over his mouth. Islamic State has been accused of using chemical weapons in Iraq and Syria, poisoning civilians in the process.
None of Fathi's relatives were hurt during the several days the militants had fought from the family home, however. He had also been sheltering several dozen people who fled their own houses nearby.
Piles of shoes lay on the floor outside the downstairs rooms, where up to 30 men, women and children from the area were living, unsure if it was safe to go back to their homes.
"We all stayed inside the rooms while the Daesh fighters were here. We ate, drank, slept and prayed there," Fathi said, glad at least that his house was among those still standing. (Reporting by John Davison; editing by Giles Elgood)