he was supported by Liparit IV, of the Liparitid clan, the most powerful noble in Georgia. Liparit, as duke of the district of Trialeti and later as a commander-in-chief of the royal armies, had appeared as the defender of a boy-king Bagrat early in the 1030s. Liparit's military prowess had been demonstrated once again in 1034 when, at the head of a combined Georgian-Armenian army, he defeated a Shaddadid troops in Arran. In 1038, Liparit was on the verge of capturing the ancient Georgian capital of Tbilisi, which had been a Muslim stronghold since the 8th century. Fearing his growing power, the Georgian nobles persuaded Bagrat to withdraw Liparit's army and thus thwarted the plan. As a result, Liparit became a sworn enemy of the king and began actively cooperating with the Byzantines for vengeance on Bagrat and his nobles. On behalf of the pretender Demetre, Liparit enjoyed a series of successes against Bagrat. In spite of Demetre's death in 1042, Liparit continued his struggle in alliance with the Byzantines and David I of Lorri. After the defeat at Sasireti, Bagrat was left with the western provinces only. During the Seljuk campaigns in Anatolia in 1048, Liparit, who had been fighting on the Byzantine side, was captured at the Battle of Kapetrou. Bagrat took advantage of this, and returned to his eastern possessions. The king's fortunes were quickly reversed, however, upon Liparit's return from captivity. The rebellious duke forced Bagrat to flee to Constantinople where he was kept, as a result of Liparit's intrigues, for three years. In the absence of Bagrat (1050–1053), Liparit was an effective ruler of Georgia; he even installed Bagrat's son George as king and declared himself a regent. After Bagrat's return, Liparit again warred against him. Eventually in 1060 his followers conspired and surrendered the duke to King Bagrat, who forced him into a monastery. Now, Bagrat gained a momentum to restrict the power of dynastic princes, reduced the kings of Lorri and Kakheti to impotence, and briefly held Tbilisi. Seljuk attacks In the 1060s, Bagrat faced with an even greater problem: the Seljuks under Alp Arslan started to penetrate the frontier regions of Georgia. Bagrat had to buy peace through marrying his niece to Alp Arslan sometime after 1064. She later married the Seljuk Persian vizier Nizam al-Mulk. The Seljuk threat prompted the Georgian and Byzantine governments to seek a closer cooperation. To secure