Spanish insurer Mapfre on Friday signed a contract to make a $983.8 million contingency payout to Colombia’s Empresas Publicas de Medellin (EPM) over issues with the construction of the massive Hidroituango dam.

The funds will guarantee that the project can be finished, Colombia President Ivan Duque said at an event to mark the agreement, and will safeguard the fiscal health of EPM and the city of Medellin.

Construction of the 2,400-megawatt Hidroituango dam began in 2010 in Antioquia province, but in April 2018 part of the infrastructure collapsed, forcing the evacuation of thousands of people and delaying the project’s completion.

The agreement cancels a recent ruling by the Comptroller General which held 26 people – incling centrist presidential hopeful Sergio Fajardo, a former governor of Antioquia – responsible for $1.1 billion in damages for the delays in the project.

“Today Hidroituango was saved,” Duque said. “This is a vital project for the energy security of our country.”

Under the deal EPM will receive a $633 million payment in January 2022, in addition to a previously made $350 million payment.

“Colombia trusted in Mapfre and Mapfre always comes through for its clients regardless of the size or complexity of the case,” said the insurer’s Colombia president, Pablo Andres Jackson.

In July EPM said the project needed an additional 2.1 trillion pesos ($538.4 million) to complete construction and have two generation units functioning by the second half of 2022. Six other units should be operational between 2023 and 2025.

Investment in the project will total some 18.3 trillion pesos ($4.69 billion).

Fajardo came in third in the first round of Colombia’s 2018 presidential elections. Though the sanction from the comptroller general is now void, he still faces an embezzlement case in the Supreme Court of Justice.

($1 = 3,899.87 Colombian pesos) (Reporting by Luis Jaime Acosta; Writing by Julia Symmes Cobb; Editing by Mark Porter)