Rudolf was granted the duchy of Swabia in 1057 by the dowager empress Agnes of Poitou, regent for her infant son Henry IV. She also appointed him administrator of the kingdom of Burgundy and gave him her daughter Matilda in marriage (1059). Rudolf at first supported Henry IV and was, in fact, largely responsible for Henry’s victory over the Saxons at the Unstrut River in 1075. The next year, however, when Pope Gregory VII excommunicated Henry and absolved his subjects from their oaths of allegiance, Rudolf turned against the king. Promising to respect the elective character of the monarchy and to renounce any royal right to the investiture of prelates, he was elected king by an assembly of dissident princes in March 1077 and two months later was crowned at Mainz. The townspeople of Mainz, however, who sympathized with Henry, rioted, and Rudolf was compelled to flee and make his way to Saxony, where he was supported by the majority of the lay and ecclesiastical nobles. After invading Rudolf’s duchy of Swabia, Henry, at the end of May 1077, held a diet at Ulm that deprived Rudolf of his duchy on a charge of treason.
Rudolf’s effective power was thereafter confined to Saxony. He fought Henry at the indecisive battle at Mellrichstadt (1078) and, more successfully, at Flarchheim (1080). Recognized at last as king by Pope Gregory, early in 1080, Rudolf on October 15 of that year won a victory over Henry at the Elster River but, in the process, received a mortal wound in the battle.