With the death of George III the main male line became extinct and the dynasty continued through the marriage of Queen Tamar with the Alan prince David Soslan, of reputed Bagratid descent. Downfall The invasions by the Khwarezmians in 1225 and the Mongols in 1236 terminated Georgia’s "golden age". The struggle against the Mongol rule created a dyarchy, with an ambitious lateral branch of the Bagrationi dynasty holding sway over western Georgia (Imereti). There was a brief period of reunion and revival under George V the Brilliant (1299–1302, 1314–1346), but the eight onslaughts of the Turco-Mongol conqueror Timur between 1386 and 1403 dealt a great blow to the Georgian kingdom. About a century later, its unity was finally shattered by two rival Turkic federations; the Kara Koyunlu, and the Ak Koyunlu. By 1490/91, the once powerful monarchy fragmented into three independent kingdoms – Kartli (central to eastern Georgia), Kakheti (eastern Georgia), and Imereti (western Georgia) – each led by a rival branch of the Bagrationi dynasty, and into five semi-independent principalities – Odishi-Mingrelia, Guria, Abkhazia, Svaneti, and Samtskhe – dominated by their own feudal clans. During the three subsequent centuries, the Georgian rulers maintained their perilous autonomy as subjects under the Turkish Ottoman and Persian Safavid, Afsharid, and Qajar domination, although sometimes serving as little more than puppets in the hands of their powerful suzerains. In this period, in order to receive investiture from their suzerains, as a necessary prequisite, many Georgian rulers converted to Islam. The line of Imereti, incessantly embroiled in civil war, continued with many breaks in succession, and the kingdom was only relatively spared from the encroachments of its Ottoman suzerains, while Kartli and Kakheti were similarly subjected to its Persian overlords, whose efforts to annihilate the fractious vassal kingdoms were in vain, and the two eastern Georgian monarchies, survived to be reunified in 1762 under King Erekle II, who united in his person both the Kakhetian and Kartlian lines, the latter surviving in male descent in the branch of Mukhraneli since 1658. Last monarchs In 1744, Erekle II and his father Teimuraz II were granted the kingships of Kakheti and Kartli respectively by their overlord Nader Shah, as a reward for their loyalty. Following Nader Shah's death in 1747, Erekle II and Teimuraz II capitalized on the eruption of instability, and declared de facto independence. After Teimuraz II died in 1762, Erekle II succeeded his