The Italian company tasked with keeping the Mosul Dam from collapsing and potentially killing tens of thousands is extending its stay in Iraq by an extra four months, a company spokesperson told Code and Dagger.

Trevi, the Cesena-based engineering firm, was scheduled to leave Iraq next month based on its original contract with the Iraqi government, but company spokesperson Pierluigi Miconi said Trevi discovered "cost optimizations" that will allow it to stay on until March 2018 at no extra charge. After that, Miconi said, Trevi will hand over its "brand new and high-tech equipment" to local engineers who are already being trained "on modern drilling and grouting equipment, technologies and techniques."

"Upon contract completion the MWR [Iraq government Ministry of Water Resources] should be capable to continue the drilling and grouting works with the equipment and the technologies left in place by Trevi," Miconi said.

The two-mile-long Mosul Dam, which lies on the Tigris river about 30 miles upstream from Mosul, Iraq's second-largest city, was constructed in the 1980s on "a foundation of soluble soils that are continuously dissolving, resulting in the formation of cavities and voids underground that place the dam at risk for failure,” according to an urgent 2007 letter (PDF) sent from top U.S. officials in Iraq to Iraq's Prime Minister.

Keeping the dam from collapsing is a never-ending task that requires the constant filling of the underground cavities with tons and tons of grout, like an industrial version of the little Dutch boy, as a geotechnical expert who worked on the dam described it to ABC News in 2014.

"[T]he most severe impact of a dam failure would be [for] the City of Mosul, located 50 kilometers [31 miles] downstream of the dam," the 2007 letter says. "Assuming a worse [sic] case scenario, an instantaneous failure of Mosul Dam filled to its maximum operating level could result in a flood wave over 20 meters [65 feet] deep at the City of Mosul, which would result in a significant loss of life and property."

A 2011 report by a member of U.S. Army Corps of Engineers said that the dam's failure "could lead to as many as 500,000 civilian deaths." (The population of Mosul in 2015 was estimated at approximately 1.5 million but has likely fluctuated since it became the site of one of the largest battles between coalition forces and ISIS earlier this year. So it's unclear if that death estimate would be accurate today.)

After a scare in which ISIS was operating in the area of the dam and claimed to have taken over what is essentially a weapon of mass destruction, U.S.-allied Kurdish forces now control the area. Miconi said the dam itself and the Trevi engineers are being guarded by a contingent from the Italian Army, and the threat from ISIS now appeared to be "less probable."

[Do you have a tip or question for Code and Dagger? Reach us at CodeAndDagger@protonmail.com. And if you like what you read and want to help keep the site running (kind of) smoothly, click here to learn how you can lend your support. This report has been updated.]