Islamic State (IS) militants have mounted a ferocious counter-attack in north Iraq, killing at least 19 people in and around the city of Kirkuk.
They attacked government buildings, killing at least six police officers, and a power station under construction, where 13 employees died, officials say.
Twelve IS fighters also reportedly died and fighting seems to be continuing.
Government and Kurdish forces began a long-awaited operation against the IS capital in Iraq, Mosul, on Monday.
Mosul lies 170km (105 miles) to the north-west of Kirkuk, a multi-ethnic city claimed both by Iraq’s central government and the Kurds.
The BBC’s Richard Galpin, in northern Iraq, said IS had attempted an “audacious” counter-attack on Kirkuk that had tried to show it was still a force to be reckoned with. The attack was “clearly aimed at diverting the Iraqi army” from Mosul, he said.
Hours after the initial assault, witnesses in Kirkuk said gunfire could still be heard and militants were walking openly through the streets.
A state of emergency was declared and Friday sermons were cancelled as mosques remain closed.
A news agency affiliated to IS said fighters had broken into Kirkuk’s city hall and seized a central hotel but officials denied this.
District police chief Brig Gen Sarhad Qadir told the BBC suicide bombers and other IS fighters had attacked three police buildings and the headquarters of a political party in Kirkuk.
“All of the militants who attacked the police emergency building and the old building of the Kirkuk police directorate have been killed but a number of other militants are still in Dumez district,” he said.
The governor of Kirkuk, Najm al-Din Karim, insisted that Kurdish Peshmerga fighters and counter-terrorism forces were completely in control of the situation.
He blamed the attack on IS sleeper cells.
“Because of the ongoing Mosul offensive, they may want to create a situation where forces would be withdrawn from there and the focus shifted to Kirkuk,” Mr Karim told Kurdish news agency Rudaw.
“Also because they are being defeated in Mosul, they want to boost their morale with these kinds of actions.”
Five Iranian employees are believed to be among the dead in the attack on the power plant to the north of Kirkuk, Iraq’s electricity ministry said.
Seven other employees and five police guards were wounded.
The power plant, which is still under construction, is being built by an Iranian company. Associated Press reported that the IS fighters had asked to be taken to the Iranian workers before killing them.
Government forces said on Friday they had regained control of a further two villages – al-Awaizat and Nanaha – south of Mosul, killing 15 IS militants and forcing 65 families to evacuate their homes.
On Friday, the UN High Commissioner for Human Rights Zeid Raad Al Hussein said the organisation had received reports of IS using people living near Mosul as human shields.
There were also reports the group had “shot dead civilians who have tried to rise up against them or who they suspect are disloyal”, he added.
Mosul battle: IS launches Iraq counter-attack at Kirkuk}