(CNN) — For 137 years, the construction of Barcelona's Sagrada Familia had been carried out illegally.

That all changed on Friday when the Roman Catholic church finally received its building permit, according to a Twitter post by Janet Sanz , in charge of urban planning.

Barcelona's city council awarded the license to the committee in charge of completing the construction of the church for 4.6 million euros ($5.2 million), Sanz wrote.

A police officer stands by the Sagrada Familia basilica in Barcelona on August 20, 2017. PASCAL GUYOT/AFP/AFP/Getty Images

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.

She told reporters that the council had finally managed to "resolve a historical anomaly in the city -- that an emblematic monument like the Sagrada Familia... didn't have a building permit, that it was being constructed illegally," Agence France-Presse reported.

Gaudí's legacy

The Catholic temple's designer, Catalan modernist Antoni Gaudí, had asked for a permit in 1885 from the city council of Sant Martí de Provençals, which is currently one of Barcelona's neighborhoods, but never received an answer, according to a Friday blog post from the church.

Related content Sagrada Familia church gets building permit, 136 years late

And even though construction of the neo-Gothic church began in 1882, authorities only discovered in 2016 that it never had planning permission, AFP reported.

Work on the Sagrada Familia, which was named a UNESCO World Heritage Site in 2005, may have dragged on for an unusually long time, but incredibly the edifice remains unfinished.

Tourists admire the intricate exterior design of the church. QUIQUE GARCIA/AFP/AFP/Getty Images

The basilica will have a maximum height of 172 meters (564 feet) and will be completed with a budget of 374 million euros, according to the new building permit seen by AFP.

Gaudí, whose idiosyncratic works are found across the Spanish coastal city, dedicated his life to building the Sagrada Familia until he was killed by a tram in 1926.