The Iraqi army and an alliance of Shiite militia groups on Saturday retook a dam northeast of Baghdad after days of fighting believed to have killed dozens, security sources said.

Fighting has been raging for days around Muqdadiyah, in Diyala province, around 90 kilometers (55 miles) from Baghdad, between jihadists from the Islamic State group and pro-government forces.

"We are now in full control of the dam," said an army lieutenant colonel, adding that the final stages of the operation on Saturday had left seven IS militants dead.

A police captain confirmed the toll.

The officers said the final push to retake Muqdadiyah dam involved Iraqi troops and fighters from the Asaib Ahl al-Haq, Badr and Saraya al-Salam Shiite militias.

Government sources in the area have reported high casualties among jihadist ranks over the past few days.

The fighting has also left many dead in pro-government ranks. At least 12 members of the Saraya al-Salam militia killed in the area were buried in the holy Shiite city of Najaf on Thursday alone.

IS fighters have repeatedly attempted to control dams across the country, and in some cases weaponized them by either reducing the flow of water to areas under government control or flooding swathes of land to impede army operations.

The jihadists briefly controlled the dam in Mosul, the country's largest, before Iraqi special forces and Kurdish peshmerga troops backed by U.S. fighters jets retook it in early August.