One of the world's most famous buildings, the Leaning Tower of Pisa, has survived everything from four powerful earthquakes to two world wars. Now, engineers may have solved the mystery of how the building has managed to survive, undamaged, for centuries.

Ironically, the reason the tower is tilted is also why it survived so long: "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," said George Mylonakis of the University of Bristol's department of civil engineering.

The height and stiffness of the tower — along with softness of the soil underneath it — reduces vibration in such a way that the tower doesn't shake during an earthquake. This has been the key to its survival, Mylonakis said. 

Because Italy is located on multiple fault lines, earthquakes have played an important part in its history, according to Popular Science. Given the vulnerability of the structure, which barely manages to stand vertically, it would be expected to sustain serious damage or even collapse during even moderate seismic activity. But thanks to the softness of the soil underneath, that hasn't happened.

The tower's original purpose was as a bell tower for the Pisa cathedral.

Now leaning precariously at a five-degree angle, construction on the 183-foot-tall Tower began in 1173 but was halted five years later. The tower likely appeared slightly tilted in 1178 because of a poorly laid foundation and loose subsoil, but became more noticeable when construction continued on the tower a century later.

It was finally finished about 200 years later. 

Benito Mussolini ordered Italian engineers to fix the tower in 1934, but that plan failed. It was almost destroyed by the Allies during World War II, who were concerned that it may have been a hideout for German snipers, but it was saved at the last moment

Mylonakis will formally announce his research at an earthquake engineering conference in Greece next month.