First Kingdom of Kakheti

The Kingdom of Kakheti-Hereti or just the First Kingdom of Kakheti was an early Medieval monarchy in eastern Georgia, centered at the province of Kakheti, with its capital first at Telavi. It emerged in 1014 AD, under the leadership of energetic ruler of principality of Kakheti, Kvirike III the Great that finally defeated the ruler of Hereti and crowned himself as a king of the unified realms of Kakheti and Hereti. From this time on, until 1104, the kingdom was an independent and separated state from the united Kingdom of Georgia. The kingdom included territories from riv. Ksani (western border) to Alijanchay river (eastern border) and from Didoeti (northern border) to southwards along the river of Mtkvari (southern border).
Establishment of the principality.
Kakheti had been a part of Kingdom of Iberia, and then a part the Principate of Iberia. However, in the second half of the 8th century, Arab sources already separates Iberia and Tzanaria (Kakheti). In struggle against Arab occupation, ruler of the Tzanaria, Grigol (possible descendant from Bagrationi dynasty) seized control over Kakheti and established a chorepiscopate, a bishopric-duchy, ruled by a prince and chorepiscopus, with one member of the feudal nobility combining both roles. The new realm controlled the Darial Pass trade route. Grigol held power until 827: hoping to rule all Georgia, aided by mountaineers and the Arab emir of Tbilisi, he invaded Inner Iberia (Shida Kartli), but was repulsed by Ashot I Kuropalates, a prince of the resurgent Bagratid dynasty of Tao-Klarjeti, and its ally Theodosius II of Abkhazia, east of the Ksani River.
Grigol was succeeded by Vache (son of John Kvabulisdze). Vache's successor Samuel (839–61) was elected as a prince by the Gardabani a nobility who dominated the politics of Kakheti at the time. He allied with the Arab emir of Tbilisi, Ishaq ibn Isma'il, in the revolt against the Caliphate and hence Kakheti became targeted by the Arab punitive expeditions led by Khalid b. Yazid (840–42), allies pushed first Khalid bin Yazid, then his son Muhammad, back into Arran. The next Arab punitive expedition led by Bugha the Turk (853–54), managed to kill the emir of Tbilisi, but lost the battle to the Kakhetians, and retreated.
In contrast to his predecessor, Gabriel was at enmity with the Arab emir of Tbilisi, Gabuloc' who dispossessed him of the district of Gardabani. He was succeeded by Padla I (r. 881–93) of the Arevmaneli clan. There is another opinion saying that Padla I, the first Arevmaneli prince was a descendant of Grigol and therefore he was Bagratid too. During his rule, Padla succeeded in recovering the district of Gardabani. Kakheti befriended the emirate of Tbilisi: they both rejected the caliphate's authority. His successor Kvirike I forged an alliance with Constantine III of Abkhazia against his eastern neighbor Hereti, a principality in the Georgian-Albanian marchlands. The allies invaded Hereti and divided its major strongholds, with the Ortchobi fortress being allotted to Kakheti.
Kvirike I was succeeded by his son Padla II, the latter built the fortress of Lotsobani. At the same time the Arabs, led by Yusuf ibn Abi'l-Sajj, arrived. He first invaded Kakheti and took hold of the fortresses of Ujarma and Botchorma, but the former was then given back to the Kakhetian ruler following his plead for peace. Arabs despoiled Kakheti, burned down Jvari and Mtskheta, and departed. In 922, Padla II aided King Ashot II of Armenia in crushing the revolt by prince Moses of Utik. Later in his reign, he also assisted George II of Abkhazia against his rebellious son and duke of Kartli, Constantine. 
Padla II was succeeded by his son Kvirike II. whose reign was spent in a continuous struggle against the expansionism of the kings of Abkhazia who ruled over a significant portion of western and central Georgia and aimed at conquering Kakheti. Subversively aided by the rebellious Kakhetian nobles, George II of Abkhazia even succeeded in dispossessing Kvirike of his principality in the 930s. Kvirike II soon recovered the crown in 957 and successfully resisted the attempts of George's successor Leon III to gain a foothold in Kakheti. After Leon's death during one of his incursions into Kakheti II (969), Kvirike capitalized on the dynastic feud in the Kingdom of Abkhazia to reassert his full authority and even expand his possessions to the west. In 976, Kvirike II invaded Kartli (central Georgia), captured the city of Uplistsikhe and took captive the Georgian Bagratid prince Bagrat who was intended by his powerful foster-father David of Tao to seat on the thrones of Iberia and Abkhazia. In response, David marshaled an army to punish Kvirike and forced him to withdraw from Kartli and release Bagrat, who would later inherit Kingdom of Georgia and proceed to press a claim to Kakheti and annexed it in or around 1010, after two years of fighting and aggressive diplomacy.
The last ruler bearing the title of chorepiscope was David and the following rulers are already titled as "The king of Kakheti and Hereti".
Establishment of the Kingdom.
Following Bagrat's death in 1014, Kvirike III, son of dethroned Kakhetian prince David, was able to recover the crown. He also took control of the neighboring region of Hereti and declared himself King of Kakheti and Hereti. He made Telavi his capital and constructed a palace at Bodoji near Tianeti. As a result of his administrative reforms, the kingdom was subdivided into seven duchies: Rustavi, Kveteri, Pankisi, Shtori, Vejini, Khornabuji and Machi. Under Kvirike III, the kingdom experienced a period of political power and prosperity.
In the beginning the kings of Kakheti were allies of Georgian kings in fights against foreign aggressors. In 1022, Kvirike III sent reinforcement to George I of Georgia against the Byzantine Empire, however they were defeated. In 1027, Kvirike joined the combined armies of Bagrat IV of Georgia led by Liparit Baguashi and Ivane Abazasdze, Emir Jaffar of Tiflis, and the Armenian King David I of Lori against the Shaddadid emir of Arran, Fadhl II, who was decisively defeated at the Eklez River. Around 1029, Kvirike III defeated an invasion force led by the Alan king Urdure who had crossed the Caucasus Mountains into Kakheti and ravaged Tianeti. Urdure was killed in battle. At the zenith of his power and prestige, Kvirike was assassinated while hunting in 1037/39. According to the Georgian historian Vakhushti, this was done by Kvirike's Alan slave who sought to avenge for the death of King Urdure. On Kvirike's death, Kakheti was temporarily annexed to the Kingdom of Georgia.
The last Arevmaneli ruler, Kvirike III had died without male heir and his sister's son Gagiki succeeded in restoring monarchy by the support of Kakhetian nobility in 1039; thus becoming the first Kuirikid monarch of the Kakheti. Through maneuvering between Bagrat IV and the powerful Georgian warlord Liparit Orbeli. Gagik managed to retain his crown and the integrity of his kingdom. He aided Bagrat in his expeditions against the Emirate of Tbilisi, but when the king of Georgia attempted to take Gagik's possessions in Hereti, Gagik allied himself with Liparit in the 1046-47 rebellion against Bagrat IV and achieved more or less stable control of his territories. He was succeeded by his son Aghsartan I, whose reign coincided with the Seljuk invasions in the Georgian lands and persistent attempts by the Georgian Bagratid kings to bring all Georgian polities into their unified realm. 
In 1068, Aghsartan submitted to the Seljuk sultan Alp Arslan, agreed to pay tribute, and secured the Turkish support against King Bagrat IV of Georgia who had seized part of the Kakhetian territory. He continued his struggle against the centralizing policy of the Georgian crown under Bagrat's successor George II and allied himself with the rebellious Liparitid clan, but then transferred his loyalty to George and helped him counter the feudal opposition, and then fight the 1074 invasion by the Seljuk sultan Malik Shah I. However, when George II made peace with the sultan early in the 1080s, the latter recognized the king of Georgia as the only legitimate master of Kakheti and gave him a Seljuk force to conquer the region. George, at the head of a combined Georgian-Seljuk army, laid a siege to the Kakhetian fortress of Vezhini, but failed to take it and withdrew. Aghsartan immediately seized the opportunity to pledge his loyalty to the Seljuks, went to Malik Shah and embraced Islam, thus winning a Seljuk protection against the aspirations of the king of Georgia.
Aghsartan I died in 1084, and was succeeded by his son Kvirike IV, who continued the same policy and ruled as a tributary to the Seljuq dynasty and opposed the energetic Georgian king David IV who pursued a vigorous domestic and foreign policy aimed at asserting Georgia's integrity and its hegemony in the Caucasus. Kvirike lost the fortress of Zedazeni to David, but was still able to secure the succession to his son Aghsartan II. The medieval Georgian chroniclers characterize Aghsartan as a frivolous man whose ignorant rule drew many great nobles into opposition. In 1105, Aghsartan was arrested by his vassals, the princes Areshiani of Hereti, and handed over to King David IV of Georgia who finally annexed the kingdom to Unified Georgian realm. Henceforth the territory of the Kingdom of Kakheti was divided into several administrative units. These administrative units were the Duchy of Kakheti, the Duchy of Hereti, Khornabuji bank and the "Land of Arishini".