The settlement of Slavs in the region has been recorded since the 520s, when Slavic tribes pillaged the Eastern Roman Empire; during Justinian I's rule (527–565), up to 100,000 Slavs raided areas far to the south of the city in Thessalonica. The region (Drina županija) was part of the Vlastimirović dynasty when they established the medieval Principality of Serbia, the first Serb state. Across the Drina, in Bosnia, the army of Časlav fought the invading Magyars in the 950s. The region was annexed by the Byzantine Empire after 969, becoming part of the Catepanate of Ras. Later, the area around the city became a part of the Theme of Sirmium.