The successful defence against the Arab Caliphate, and new territorial gains in the east, gave the Abasgian princes enough power to claim more autonomy from the Byzantine Empire. Towards circa 778, Prince Leon II, with the help of the Khazars declared independence from the Byzantine Empire and transferred his residence to Kutaisi. During this period the Georgian language replaced Greek as the language of literacy and culture.The Kingdom of Abkhazia was united through dynastic succession with the newly formed Kingdom of Georgia in 1008 when Bagrat II of Abkhazia became Bagrat III of Georgia.The western Georgian kingdom of Abkhazia flourished between 850 and 950, which ended by unification of Abkhazia and eastern Georgian states under a single Georgian monarchy ruled by King Bagrat III at the end of the 10th century and the beginning of the 11th century.