Militants attacked and took control of parts of the central Iraq city of Baquba but security forces eventually repelled the assault on Tuesday, army and police officers said.
The overnight attack took place in the centre of Baquba, capital of Diyala province, and according to the officers, saw militants temporarily occupying several neighbourhoods.
The city, located just 60 kilometres (37 miles) north of Baghdad, is the closest the fighting has come to the capital since a major militant offensive swept down from the north last week.
The offensive, led by jihadists from the Islamic State of Iraq and the Levant group but also involving others including supporters of ousted dictator Saddam Hussein, overran all of one province and major parts of three more since it began late on June 9.
Security forces performed poorly during the initial assault, in some cases abandoning uniforms and vehicles to flee, but seem to be recovering somewhat from the shock of the onslaught, and have begun to push back.