Iraqi security and hospital officials say three soldiers have been killed and five wounded in an ambush on an army patrol north of Baghdad.

The officials say a group of militants opened fire on the patrol Tuesday in the town of Tarmiyah, a former insurgent stronghold about 50 kilometers (30 miles) north of the Iraqi capital.

The officials, who spoke on condition of anonymity in line with regulations, blamed the Islamic State group, but there was no immediate claim of responsibility.

The shooting was the latest in a string of attacks along roads and in villages in areas north and west of Baghdad, many of them claimed by the extremist group. Iraq declared victory over IS in 2017 after a devastating four-year war.