Barcelona’s famously unfinished Sagrada Familia church has agreed to pay $41 million to city authorities after it was found to be lacking a building permit — despite breaking ground on construction well over a century ago.

The basilica will pay the city authorities back over a period of 10 years under new municipal registration, its first since construction began in 1882, the BBC reports. Barcelona Mayor Ada Colau hailed the deal as a historic agreement.

Funds from the deal are to be allocated to municipal projects such as improving the metro system and surface transport, as well as maintenance and public services in the area, according to a news release.

The church was designed by Catalan architect Antoni Gaudí, a modernist who also created several other eccentric edifices dotting Barcelona’s cityscape.

Despite the building’s impact on the community, it has been under construction for more than a century while holding no official status and without oversight of municipal authorities, according to Spain’s El Pais newspaper.

Read more: The Saga of Barcelona’s La Sagrada Familia

Gaudí died in 1926, but his unfinished masterpiece was nonetheless recognized as a UNESCO World Heritage site and has become one of Barcelona’s top tourist attractions. Today, it receives an estimated 20 million visitors a year, including 4.5 million who enter the sprawling chapel.

The church is slated for completion in 2026 — a century after its creator’s death.

Write to Eli Meixler at eli.meixler@time.com.