Mosul battle: Four ways IS is fighting back
After more than a week of fighting, the Iraqi army and Kurdish forces are now getting close to the eastern outskirts of Mosul, the last city in Iraq still under the control of so-called Islamic State (IS).
The Iraqi authorities hope the joint offensive will succeed in pushing IS out of the city, which would be a crushing defeat for the militants and leave them with very little territory in Iraq.
But over the past week IS has been hitting back hard on the battlefield, and in various towns and cities.
It is gradually revealing a battle plan which it has probably been working on since it seized control of Mosul in June 2014, knowing that this day of reckoning would eventually come.
This is the latest tactic deployed by the militants since the offensive began, with a spate of attacks around the country starting last Friday in the strategic, Kurdish-controlled city of Kirkuk.
At least 100 IS gunmen and suicide bombers, including some who had been members of sleeper cells living inside the city, tried to take control of key government and police buildings as well as attacking a power station being built there.
As they entered Kirkuk, they called on Sunni Muslims to come out of their homes and fight with them and some heeded the call, according to one source who spoke to the BBC.
At least 98 people were killed in the attack, most of them civilians.
Sources say 2,000 Kurdish fighters (known as the Peshmerga) were pulled back from the Mosul offensive, to help bring the situation in Kirkuk back under control.
The security forces' commander in Kirkuk, Halo Najat, told the BBC he believed the militants also planned to cut the main road from Baghdad to Kirkuk and the road from Kirkuk to Mosul to disrupt supply lines for Iraqi and Kurdish troops involved in the Mosul offensive. However, they were killed before they could do this.
Since the assault on Kirkuk, there have been attacks on the town of Rutba in western Iraq and the Sinjar region to the west of Mosul.
More on Mosul
- Kurds besiege IS-held town outside Mosul
- Anti-IS forces attack town near Mosul
- Is so-called Islamic State finished?
- Battle for Mosul: The story so far
Fleets of suicide car bombs
The sight of a cluster of cars or trucks speeding towards the front lines of the Mosul offensive has sparked panic among some Iraqi troops and Kurdish fighters, who know it is highly likely the vehicles are packed with explosives and driven by suicide bombers.
This is a new tactic by IS designed to make it difficult for troops to stop all the vehicles reaching their positions.
Small arms fire is not effective as the vehicles normally have armoured plating around them. Destroying them requires several anti-tank missiles to be fired rapidly.
The alternative is to call for air strikes, if there is time.
The militants try to conceal suicide vehicles before they are used.
As the Iraqi army and Kurdish forces have advanced towards Mosul, regaining control of towns and villages which had been in the hands of IS, they have discovered networks of tunnels dug in many areas, a classic tactic for guerrilla warfare.
They seem to be primarily defensive, designed to protect the militants from air strikes, artillery and other attacks. Inside the tunnels troops have found sleeping bags, food supplies, water, and even electricity cables so the users have light.
The tunnels are often dug beneath buildings, including mosques, so the excavation work cannot be spotted. But the tunnels can also be used for surprise attacks.
In one of the most dramatic moments captured on video since the offensive began, an IS militant climbs out of a tunnel in a rural area and opens fire on a group of soldiers who had presumably thought they were on safe ground. The man then blows himself up before the soldiers can react.
It is assumed that there is a similar network of tunnels in Mosul city itself, which could enable IS fighters and their leaders to hide during the anticipated assault and if necessary escape.
Troops have found booby-traps in tunnels which the militants have been forced to flee, including one which had been attached to a copy of the Koran.
Booby-traps, improvised explosive devices (IEDs) and mines have also featured in the defensive plans of IS, with huge numbers left on roads and in buildings in the towns and villages which they have been forced to abandon as the military offensive has progressed.
Much concern has already been expressed about the possibility of IS using civilians in areas under its control - particularly in Mosul itself - as human shields.
A senior Kurdish intelligence officer told me recently that they had information that IS had already started doing this, describing it as a sign of weakness and desperation.
The officer was not clear where this was happening, but if it is correct, it will make the assault on Mosul city even more complicated than it was already likely to be, assuming IS does decide to stand and fight.
Iraqi army generals have told me their key concern in this offensive is to avoid civilian casualties. The population of Mosul is estimated to be more than a million people.