Islamic State launched a major counter-attack on the city of Kirkuk on Friday as Iraqi and Kurdish forces pursued operations to seize territory around Mosul in preparation for an offensive on the jihadists' last major stronghold in Iraq.
Islamic State's assault on Kirkuk, which lies in an oil- producing region, killed 18 members of the security forces and workers at a power station outside the city, including two Iranians, a hospital source said.
Crude oil production facilities were not targeted and the power supply continued uninterrupted in the city. Kirkuk is located east of Hawija, a pocket still under control of Islamic State that lies between Baghdad and Mosul.
With air and ground support from the US-led coalition, Iraqi government forces captured eight villages south and southeast of Mosul. Kurdish forces attacking from the north and east also captured several villages, according to statements from their respective military commands overnight.
The offensive that started on Monday to capture Mosul is expected to become the biggest battle fought in Iraq since the US-led invasion in 2003.
In Kirkuk, Islamic State attacked several police buildings and a power station in the early hours of Friday and some of the attackers remained holed up in a mosque and an abandoned hotel.
The militants also cut the road between the city and the power station 30km to the north.
Several dozen took part in the assault, according to security sources who couldn't confirm a claim by Islamic State that it had taken a Kurdish police officer hostage.
The assailants in Kirkuk came from outside the city, said the head of Iraq's Special Forces, Lieutenant General Talib Shaghati, speaking on a frontline east of Mosul. Iran's Foreign Ministry spokesman Bahram Ghasemi reacted to the killing of the Iranian citizens in Kirkuk, saying these attacks are "the last breath of terrorists in Iraq".
At least eight militants were killed, either by blowing themselves up or in clashes with the security forces, the sources said. Kurdish forces had dislodged the militants from all the police and public buildings they had seized before dawn, they said.
Kurdish NRT TV footage showed machine gun fire hitting a drab two-floor building that used to be a hotel, and cars burning in a nearby street.
Islamic State claimed the attacks in online statements, and authorities declared a curfew in the city where Kurdish forces were getting reinforcements.
Kurdish Peshmerga fighters took control of Kirkuk in 2014, after the Iraqi army withdrew from the region, fleeing an Islamic State advance through northern and western Iraq.
On the frontline south of Mosul, thick black smoke lingered from oil wells that Islamic State torched to evade air surveillance, in the region of Qayyara.
The army and the US-led coalition took back this region in August and are using its air base as a hub to support the offensive on Mosul.
The army Humvees at the checkpoint carried Shi'ite flags, revealing that the soldiers of this unit belonged to Iraq's majority community.
Flying Shia flags in the predominantly Sunni region and the participation of the Popular Mobilisation Force, a coalition of mostly Iranian-trained militias, in a support role to the army has raised concerns of sectarian violence and revenge killings during or after the battle.