wife, Agnes of Thuringia. However, neither her husbands nor her son succeeded in settling the Babenberg inheritance under their power. Gertrude's only surviving child, Agnes of Baden, tried to reclaim at least part of her inheritance through her third husband Ulrich II of Heunburg, but was unsuccessful. After some years of struggle known as the or War of the Babenberg Succession (1246–1256/78/82), the Duchies of Austria and Styria fell to Ottokar II of Bohemia, and subsequently to Rudolph I of Habsburg, whose descendants were to rule Austria until 1918. Genetic legacy Byzantine blood All the Babenberg dukes from Leopold V onward were descended from Byzantine emperors — Leopold's mother, Theodora Komnene, being a granddaughter of the Emperor, John II Komnenos. Subsequently, Leopold V's younger son, Leopold VI, also married a Byzantine princess (Theodora Angelina), as did his youngest son (by Theodora), Frederick II, who married Sophia Laskarina. The Babenbergs and the Habsburgs The next dynasty in Austria—the Habsburgs—were originally not descendants of the Babenbergs. It was not until the children of Albert I of Germany that the Babenberg blood was brought into the Habsburg line, though this blood was from the pre-ducal Babenbergs. A side effect of this marriage was the use of the Babenberg name Leopold by the Habsburgs for one of their sons. The Habsburgs did eventually gain descent from the Babenberg dukes, though at different times. The first Habsburg line to be descended from the Babenbergs was the Albertine line. This was achieved through the marriage of Albert III, Duke of Austria to Beatrix of Nuremberg. As such, their son, Albert IV, Duke of Austria, was the first Habsburg duke who was descended from the Babenberg dukes. However, the male line of that branch of the Habsburgs died out in 1457 with Ladislas V Posthumus of Bohemia. The next Habsburg line to gain Babenberg blood was the Styrian line, which occurred with the children of Ferdinand I, Holy Roman Emperor and Anna of Bohemia and Hungary, the latter of whom descended from Babenberg dukes. It was actually from Elizabeth of Austria, the sister of Ladislas V Posthumus of Bohemia, that the Styrian line gained their Babenberg blood. The Spanish line was the last Habsburg line to gain Babenberg blood. Again it was via the previous Habsburg line to gain Babenberg blood (i.e. the Styrian) that the Spanish Habsburg gained their descent from the Babenbergs — Anna of