Civilians lined up for aid distribution in the Mamun neighborhood of Mosul.

Ivor Prickett for The New York Times

The photojournalist Ivor Prickett spent three weeks documenting the battlefront and humanitarian crisis in west Mosul.

The war to drive the Islamic State from its last strongholds in western Mosul has come to this: With every advance by Iraqi forces, every missile rained down by coalition aircraft, a flood of Iraqi civilians hits the streets.

It is no longer a question of waiting between salvos — there are few, if any, breaks that make it obvious when to run, so the people of Mosul are simply running whenever they can.

As we traveled with Iraqi special forces deep in western Mosul last week, in the mostly residential Mosul Jidideh neighborhood, we saw desperate families start out right at daybreak. Families carried their young children and propped up their aging relatives, and they all moved as quickly as they could along streets where the sounds of battle were all too close: a cacophony of gunfire, the dull thud of mortar rounds, the deafening roar of Islamic State car bombs and American airstrikes.

Nearly everyone frantically asked which way was safe for them to flee. One route forced people to file past a destroyed building on the corner of the square where fighters with the Islamic State, also known as ISIS or ISIL, had been targeted the night before. One of the militants lay visible in the rubble near the crowd of silent refugees, his crumpled body almost camouflaged among the stone and twisted metal.

Civilians passing the body of an Islamic State fighter.

Ivor Prickett for The New York Times

In their state of anxious flight, many didn't even notice the corpse. But occasionally, children would gawk in horror as they were whisked past by elder siblings and parents.

Around a half-million people are still thought to be trapped in an ever-shrinking area of the city along with an estimated 2,000 remaining Islamic State fighters. There, they are caught in a frightening crossfire. As Iraqi forces have advanced, American airstrikes have at times leveled entire blocks — including the one in Mosul Jidideh this month that residents said left as many as 200 civilians dead. At the same time, the Islamic State fighters have used masses of civilians as human shields, and have been indiscriminate about sniper and mortar fire.

Near one position held by Iraqi forces, this woman screamed out in horror after the loss of her son in an ISIS mortar attack, right on her doorstep.

A grieving mother in western Mosul.

Ivor Prickett for The New York Times

Nearby, neighbors loaded those wounded in the same attack into the back of a small truck, hoping to get them to a first-aid station.

Civilians being taken for treatment after a mortar strike.

Ivor Prickett for The New York Times

The Islamic State's seemingly endless supply of car bombs has taken a fearsome toll in the battle. As we moved with the Iraqi troops into the neighborhood of Shuhada, scenes of immense destruction and the acrid smell of explosives bore testament to the fierce battle that had taken place the day before between Iraqi special forces and the militants.

And then, another blast, close to us. This car bomb had actually failed to detonate after being abandoned by its driver. The explosion was from a coalition airstrike called in to remove it as a threat.

A coalition airstrike blew up a car bomb that had failed to explode.

Ivor Prickett for The New York Times

On the corner of a main square in Shuhada, we found an ISIS car bomb that had partly detonated. The front part of the armored vehicle was a burned-out mess, but the back was still loaded with explosive canisters.

The charred and severed body of a suicide car bomber whose vehicle had failed to fully detonate sat on the corner of an intersection beside his half-destroyed vehicle. Another body of an Islamic State fighter sat in the middle of the road, splayed out on a wooden cart.

With heavy ordnance going off all around, Iraq's specialized counterterrorism forces have been tasked with painstakingly clearing neighborhoods like Mosul Jidideh.

Iraqi special forces soldiers cleared the last pockets held by the Islamic State in Mosul Jidideh.

Ivor Prickett for The New York Times

The Islamic State is not giving up ground quickly, and seems to be able to mount counterattacks everywhere.

After one car bomb disabled two Iraqi special forces vehicles, ISIS snipers hidden nearby began shooting at the soldiers. Some Iraqi commandos raced up to the top of a tall building nearby, and it suddenly became a battle for the rooftops that lasted for hours.

An Iraqi special forces soldier fired on Islamic State positions from a rooftop in the Shuhada neighborhood.

Ivor Prickett for The New York Times

Even with fighting all around them, many Mosul residents have heeded the government's requests to stay home as long they can hold out. But after months of being trapped, most are in dire need of food and water. With the fighting still heavy, international groups have been unable to reach some of the worst off.

Government aid distribution is overseen by local militia fighters. They take place irregularly and very often descend into chaos as desperate people fight for bags of rice and sugar, as prices have skyrocketed over the past four months since the offensive began. Here, western Mosul residents begged for help at an aid distribution location in the Mamun neighborhood.

People waiting for aid in the Mamun neighborhood.

Ivor Prickett for The New York Times

Even those who have been able to break away from the worst fighting find themselves in acute need, like this family waiting for help on the side of the road in Mamun.

A family in western Mosul who had fled their home in the city.

Ivor Prickett for The New York Times

The accounts of losses within families are grim. Mohammed Hamed, 5, and his sister Amina, 4, were hastily buried together in a shallow grave in the courtyard of a school in Mosul Jidideh. They were hurt at home by an airstrike that struck Islamic State positions at a nearby house, the family said, and died hours after the blast because the family was unable to reach medical help.

Friends and family members struggled to dig a hole big enough for their tiny bodies, interrupted by a sudden and terrifying new round of airstrikes nearby.

After the rushed burial, their mother, Amira, stood and waved at the grave, saying over and over: "Goodbye, my children! Travel safely to God!" The family quickly set out for the safety of a camp outside the city.

Within Mosul Jidideh, the grinding nature of the fighting stood out. At every corner there seemed to be some fresh wreckage or rubble.

The aftermath of fierce fighting between Iraqi special forces and the Islamic State in western Mosul.

Ivor Prickett for The New York Times

Behind the front line in the neighborhood, Iraqi fighters moved along devastated streets.

Iraqi special forces soldiers in western Mosul.

Ivor Prickett for The New York Times

Seeking to cover clearing operations around them, Iraqi soldiers are always climbing, seeking the high ground of rooftops and corners.

An Iraqi soldier carried a rocket launcher to the roof of a house in the Shuhada neighborhood.

Ivor Prickett for The New York Times

In one area, special forces soldiers searched a house that had been used by Islamic State fighters up until the day before. A hole in the wall in the front garden led to the neighbors' yard next door, made so that the fighters could move through the area without being seen. Inside there was very little trace of the men who had lived there, except for some daggers, a large black baton and an ISIS flag hanging above a double bed in the master bedroom.

Even in places that seem cleared, snipers are a constant threat. This man was brought to a special forces outpost in Mosul Jidideh after being hit in the leg.

A man who had been shot in the leg by an Islamic State sniper.

Ivor Prickett for The New York Times

Some of the destruction carries the clear hallmark of the Islamic State's heavy car-bombing campaign. This man called out to his family after discovering that his father was among those killed in one attack.

A man who learned that his father had been killed in a suicide car bombing.

Ivor Prickett for The New York Times

The moments after those attacks are always fraught with anxiety. Is another bomb on the way? Will sniper fire or some heavier ground assault unfold now, as is often seen from the Islamic State? After the car-bombing, this Iraqi federal police officer ran toward the explosion to fight off any potential follow-up and look for survivors.

An Iraqi federal police officer ran into the smoke after a suicide car bombing.

Ivor Prickett for The New York Times

Last week, after all that had happened in Mosul Jidideh, Iraqi forces said they had nearly cleared the last pockets of Islamic State fighters from the neighborhood. But it is just one of many in western Mosul, and the toll here is staggering.

Even if a government triumph finally and permanently comes to this district, it will forever be the place where coalition airstrikes killed dozens of people seeking safety; where families left so many dead behind while fleeing the terror of ISIS; where victory looked like destruction.

An Iraqi soldier during an early morning operation in the Mosul Jidideh neighborhood.

Ivor Prickett for The New York Times