In 518, Scupi was destroyed by a violent earthquake, possibly the most devastating the town experienced. At that time, the region was threatened by the Barbarian invasions, and the city inhabitants had already fled in forests and mountains before the disaster occurred. The city was eventually rebuilt by Justinian I. During his reign, many Byzantine towns were relocated on hills and other easily defendable places to face invasions. It was thus transferred on another site: the promontory on which stands the fortress. However, Scupi was sacked by Slavs at the end of the 6th century and the city seems to have fallen under Slavic rule in 595. The Slavic tribe which sacked Scupi were probably the Berziti, who had invaded the entire Vardar valley. However the Slavs did not settle permanently in the region that had been already plundered and depopulated, but continued south to the Mediterranean coast. After the Slavic invasion it was deserted for some time and is not mentioned during the following centuries. Perhaps in the late 7th or the early 8th century the Byzantines have again settled at this strategic location. Along with the rest of Upper Vardar valley it became part of the expanding First Bulgarian Empire in the 830s.