The 16th century was a return to more unsettled times, with persistent conflicts between the nobles and citizens, and repeated attacks from the Ottoman Empire, now occupying the mainland. In 1571 Hvar was sacked by the Turkish fleet on its way to the Battle of Lepanto, and only the fortress saved the townspeople. Just as the town was being rebuilt, it suffered further damage in 1579 as lightning struck the gunpowder magazine in the fortress. Many of today's public buildings in Hvar date from the reconstruction following the explosion.