Iraqi troops backed by helicopter gunships fought on Saturday to retake full control of a northern town from militants who had overran parts last week.
Talib Mohammed, the mayor of Sulaiman Pek, 100 miles north of Baghdad, said the army had met fierce resistance in some parts of the town after gaining some ground on Friday.
“Snipers and roadside bombs are preventing the army from totally controlling the town,” he said. “A police captain was killed by a sniper this morning while he was trying to evacuate his family.”
Militants raised the black flag of the Islamic State in Iraq and the Levant (ISIL) - a Sunni group also fighting in neighbouring Syria - over parts of Sulaiman Pek on Thursday.
An army captain in the city said snipers were hindering bomb disposal teams faced with dozens of explosive devices.
“Our job is not easy, it's a guerrilla war,” said Captain Falah Abdul-Ameer. “Snipers are a big issue now. We can't work out their exact location, they shoot and change places.”
South of Baghdad, ISIL militants killed at least eight soldiers in overnight clashes in Jurf al-Sakhar, 40 miles from the capital, army and police sources said.
They reported that 12 militants were also killed in the fighting, which started when the army responded to reports of insurgents gathering in the swamps and orchards in the area.
ISIL and other Sunni Muslim rebels have gained strength in Iraq over the past year. On 1 January they seized the city of Fallujah in the western desert province of Anbar.
They also have footholds in Ramadi, the nearby provincial capital.
Nuri al-Maliki, the Prime Minister, visited an army base west of Ramadi on Friday night to meet military commanders and tribal leaders and discuss army operations, local officials said.
During the visit to al-Assad base, he promised 10,000 jobs in the security forces for tribal fighters who have sided with the government against militants, the officials said.
Fighting erupted in Ramadi between militants and security forces backed by tribesmen early on Saturday. Helicopters bombarded militant positions in central areas of the city, amid explosions and gunfire.