When the Armenian "sparapet", Vahram Pahlavuni, prepared the coronation of the successor to Hovhannes-Smbat, the king's nephew, Gagik II, who at that time was only fourteen years old, the Byzantine emperor began supporting "vestes" Sargis Haykazn, a pro-Byzantine Armenian prince and minister of the former king, who had initially been appointed regent. After this the kingdom of Ani resisted three assaults of the Byzantine Empire, forcing them to retreat. Byzantium exerted its forces to the utmost in order to conquer Armenia and once and for all annexing it to the empire. To this end, they sent a great army to the southern part of Armenia and at the same time convinced the king of Tashir-Dzoraget to attack Ani from the east. At the fierce battle that was fought by the walls of Ani, general Vahram Pahlavuni heavily defeated the Byzantine army, forcing them to leave 20,000 dead behind, according to contemporary Armenian chroniclers. This victory allowed Vahram Pahlavuni along with Catholicos Petros I Getadardz to crown Gagik II king of Armenia and subsequently take the fortress of Ani, which was in the hands of Vest Sargis. Sargis fled to the fortress of St. Mary and was eventually captured.