BAGHDAD (AP) — Iraq signed a deal with an Italian company on Wednesday to repair and maintain its largest dam, near the northern, Islamic State-held city of Mosul, which is in danger of catastrophic collapse, a government spokesman said.

The Mosul Dam grabbed headlines recently amid fears it could collapse due to neglect and lack of needed maintenance because of the ongoing fighting between Iraqi forces and the IS extremist group, which controls large swaths of northern and western Iraq.

The contract, worth €273-million contract or about $296 million, was signed on Wednesday in Baghdad with Italy's Trevi group, government spokesman, Saad al-Hadithi, told The Associated Press.

Al-Hadithi wouldn't give a specific timeframe for when the work would start, but said it needed to be "as quickly as possible."

The dam was built on the Tigris River in the early 1980s on unstable ground where the earth underneath it is constantly being eroded by water. From the day it was inaugurated, maintenance crews have had to continuously pour cement under its foundation in what is known as "grouting."

Things worsened when IS overran the dam and held it for several weeks in 2014 until U.S.-backed Iraqi forces retook the dam. Since then, efforts to enforce the dam's foundations have not been up to full levels, in part because the IS militants control the nearby factory that produces the concrete for the dam.

Although warnings of possible collapse first started back in 2006, when a U.S. Army Corps of Engineers report called it "the most dangerous dam in the world," those warnings stepped up recently amid the deteriorating situation.

On Sunday, the Iraqi government and the U.S. Embassy in Baghdad warned residents along the Tigris of the dam's possible collapse.

Iraqi Prime Minister Haider al-Abadi asked Mosul residents along the Tigris to move at least 6 kilometers (3.7 miles) away from its banks. And the U.S. Embassy called the dam's risk of collapse "serious and unprecedented."

"Prompt evacuation offers the most effective tool to save lives of the hundreds of thousands of Iraqis," the embassy said, estimating that floodwaters could kill nearly 1.5 million Iraqis living along the Tigris.

The government's director in charge of all Iraqi dams, Mahdi Rasheed, said the 18-month deal signed Wednesday "will help improve the situation at the dam and will develop the capabilities of Iraqi cadres with the most needed training and modern technologies."

He added that the deal stipulates the work should start in the "coming few days," with basic preparation work that could take four to six months.

___

This story has been corrected to show that the deal is worth €273 million, not € 275 million.