(CNN) — After more than a century of illegal construction work, Barcelona's towering Sagrada Familia church has finally agreed to make things right with the city council.
Under the terms of a historic deal, church trustees will be able to get the permits they need in return for payments totaling €36 million ($41 million) over the next decade.
The money will be used to fund projects designed to mitigate the impact of approximately 4.5 million people who visit the unfinished basilica every year.
Tourists admire the intricate exterior design of the church.
QUIQUE GARCIA/AFP/AFP/Getty Images
Barcelona Mayor Ada Colau hailed the impact of the agreement in a tweet.
"The Sagrada Familia is an icon and the most visited monument in our city," she wrote.
"After two years of dialog we have made an agreement that will guarantee the payment of the license, secure access to the monument and facilitate local life with improvements to public transport and redevelopment of the nearby streets."
A police officer stands by the Sagrada Familia basilica in Barcelona on August 20, 2017.
PASCAL GUYOT/AFP/AFP/Getty Images
Of the total, €22 million will be used to upgrade transport infrastructure serving the church and another €7 million to boost accessibility on the wider metro system of the second-largest city in Spain.
A further €4 million will be used to remodel four major roads and €3 million dedicated to keeping the area clean and safe.
The church tweeted about predicted improvements in the organization of the local area.
Work on the Sagrada Familia may have dragged on for an unusually long time, but incredibly the edifice remains unfinished.
Construction of a neo-gothic church began in 1882 under the direction of architect Francisco de Paula del Villar y Lozano, but he soon resigned.
He was replaced by Antonio Gaudí, the Catalan modernist whose idiosyncratic works are found all over Barcelona. Gaudí dedicated his life to building the Sagrada Familia until he died in 1926 after being hit by a tram.
Since then a string of architects have worked to finish the church according to Gaudí's original design and work is scheduled to end in 2026, marking 100 years since his death.