Builders had barely finished the second floor of the Tower of Pisa when the structure started to tilt. Despite foundational issues, the project was completed, and eight centuries and at least four major earthquakes later, the precarious landmark remains standing. Now, a team of engineers from the University of Bristol and other institutions claims to have finally solved the mystery behind its endurance.

Pisa is located between the Arno and Serchio rivers, and the city's iconic tower was built on soft ground consisting largely of clay, shells, and fine sand. The unstable foundation meant the tower had been sinking little by little until 2008, when construction workers removed 70 metric tons of soil to stabilize the site. Today it leans at a 4-degree angle—about 13 feet past perfectly vertical.

Now researchers say that the dirt responsible for the tower's lean also played a vital role in its survival. Their study, which will be presented at this year's European Conference on Earthquake Engineering in Greece, shows that the combination of the tall, stiff tower with the soft soil produced an effect known as dynamic soil-structure interaction, or DSSI. During an earthquake, the tower doesn't move and shake with the earth the same way it would with a firmer, more stable foundation. According to the engineers, the Leaning Tower of Pisa is the world's best example of the effects of DSSI.

"Ironically, the very same soil that caused the leaning instability and brought the tower to the verge of collapse can be credited for helping it survive these seismic events," study co-author George Mylonakis said in a statement.

The tower's earthquake-proof foundation was an accident, but engineers are interested in intentionally incorporating the principles of DSSI into their structures—as long as they can keep them upright at the same time.