During the reign of Vakhtang I of Iberia (5th century) Rustavi took an important part in the political life in Kingdom of Iberia. At the beginning of the 6th century, in 503, Sassanids conquered Iberia and turned it into ordinary Persian province ruled by a "marzpan" (governor). However, Byzantine Emperor Heraclius's offensive in 627 and 628 brought final victory over the Persians and ensured Byzantine predominance in Georgia, until the invasion of the Arabs. In struggle against Arab occupation Rustavi belonged to Principality of Kakheti, the latter would form Kakhetian kingdom, whose ruler Kvirike III the Great would install Eristavi (duke) in Rustavi. On Kvirike's death, Kakheti was temporarily annexed to the Kingdom of Georgia. As soon as Arabs were defeated, in 1068 Georgia was invaded by resurgent Turk-Seljuks from Central Asia, under the command of Sultan Alp Arslan. There was a terrible battle between king Bagrat IV of Georgia and Seljuks, where Bagrat was bitterly defeated and as a result, the king of Kakheti gained independence and got into closer contact with the Turkish-Seljuks to secure independence in this way. After Seljukid invasions of Georgia, allied forces took Tbilisi and Rustavi and gave it to Emir of Tbilisi. During that time Rustavi saw decline, its economy was ruined and due to its strategic location it only remained as a well-fortified town in hands of emirs in Tbilisi. In 1069 Bagrat IV defeated emir Fadlun and captured the fortress of Rustavi, Partskhisi and Agarani. During the anti-Seljuk campaigns led by David IV Rustavi played an essential role in securing Georgia's southern boundaries. Rustavi was finally destroyed after Timur's invasion of Georgia.