The nation of Georgia was first unified as a kingdom under the Bagrationi dynasty by the King Bagrat III of Georgia in the early 11th century, arising from a number of predecessor states of the ancient kingdoms of Colchis and Iberia. The Kingdom of Georgia flourished during the 10th to 12th centuries under King David IV the Builder and Queen Tamar the Great, and fell to the Mongol invasion by 1243, and after a brief reunion under George V the Brilliant to the Timurid Empire. By 1490, Georgia was fragmented into a number of petty kingdoms and principalities, which throughout the Early Modern period struggled to maintain their autonomy against Ottoman and Iranian (Safavid, Afsharid, and Qajar) domination until Georgia was finally annexed by the Russian Empire in the 19th century.