at the Battle of Kressenbrunn, ending years of disputes over Styria with Béla IV. Béla now ceded Styria back to Ottokar, and his claim to those territories was formally recognized by Richard of Cornwall, then king of Germany and nominal ruler of all the German lands. This peace agreement was also sealed by a royal marriage. Ottokar ended his marriage to Margaret and married Béla's young granddaughter Kunigunda of Halych, who became the mother of his children. The youngest of them became his only legitimate son, Wenceslaus II. During the Imperial Imperial interregnum of 1250 to 1273, Ottokar could increase his personal influence while Richard of Cornwall and Alfonso of Castile jostled to attain the Imperial dignity. In 1266 he occupied the Egerland in north-west Bohemia, and in 1268 he signed an inheritance treaty with the Sponheim duke Ulrich III of Carinthia, succeeding him in Carinthia, Carniola and the Windic March the next year. In 1272 he also acquired Friuli. His rule was once again contested by the Hungarians on the field of battle. After another victory, Ottokar became the most powerful king within the Empire. The path to the final battle After Richard of Cornwall died in April 1272 and Pope Gregory X rejected the claims raised by Alfonso of Castile, a new election for the Imperial German throne took place in 1273. However, the Bohemian king again failed to win the Imperial crown, as the electors voted for the "little count" Rudolf of Habsburg, Ottokar's last and finally victorious rival. Přemysl Ottokar refused to acknowledge Rudolf's election, and urged the Pope to adopt a similar policy. At a convention of the Imperial Diet at Nuremberg in 1274, Rudolf decreed that all Imperial lands that had changed hands since the death of the last Hohenstaufen emperor Frederick II must be returned to the crown. This would have deprived Ottokar not only of the Egerland, but also of the Austrian, Styrian, and Carinthian duchies. In 1275 Rudolf placed Ottokar under the Imperial ban and besieged his Hofburg residence in Vienna, while a rebellion led by the Vítkovci noble Zavis of Falkenstein disrupted the Bohemian lands. This compelled Přemysl Ottokar in November 1276 to sign a new treaty by which he gave up all claims to Austria and the neighboring duchies, retaining for himself only Bohemia and Moravia. Ottokar's son Wenceslaus became betrothed to Rudolf's daughter Judith. There followed an uneasy