Ottocar next purchased of Ulric, Duke of Carinthia and Carniola, who had no issue, the right of succeeding to those duchies on his death. In the deed of transfer, instituted December, 1268, Ulric describes himself as without heirs; although his brother Philip, Archbishop of Salzburg, was still living. On the death of Ulric, in 1269 or 1270, Ottocar took possession of those duchies, defeated Philip, who asserted his claims, and forced the natives to submit to his authority.

By these accessions of territory, Ottocar became the most powerful prince of Europe, for his dominions extended from the confines of Bavaria to Raab in Hungary, and from the Adriatic to the shores of the Baltic. On the contrary, the hereditary possessions of Rudolph were comparatively inconsiderable, remote from the scene of contest, and scattered at the foot of the Alps and in the mountains of Alsace and Swabia; and though head of the empire, he was seated on a tottering throne, and feebly supported by the princes of Germany, who raised him to that exalted dignity to render him their chief rather in name than in power.

Although the princes and states of the empire had voted succors, many had failed in their promised assistance, and, had the war been protracted, those few would have infallibly deserted a cause in which their own interests were not materially concerned. The wise but severe regulations of Rudolph for extirpating the banditti, demolishing the fortresses of the turbulent barons, and recovering the fiefs which several of the princes had unjustly appropriated, excited great discontent. Under these circumstances the powerful and imperious Ottocar cannot be deemed rash for venturing to contend with a petty count of Switzerland, whom he compared to those phantoms of sovereignty, William of Holland and Richard of Cornwall, or that he should conclude a king of Bohemia to be more powerful than an emperor. The event, however, showed that he had judged too hastily of his own strength and of Rudolph's comparative weakness, and proved that, when the reins of government were held by an able hand, the resources of the empire were still considerable, and its enmity an object of terror.

Rudolph derived considerable support from his sons-in-law the Electors of Palatine and Saxony, and from the Elector of Brandenburg; the Burgrave of Nuremberg, the nobles of Alsace and Swabia, and the citizens and mountaineers of Switzerland. Having made the necessary preparations, he, with a judicious policy, turned his attention to those princes who, from the vicinity of their dominions, were in a state of continual enmity or warfare with the King of Bohemia. He concluded a treaty with Ladislaus, King of Hungary, and strengthened the bond of union by betrothing his daughter to Andrew, Duke of Slavonia and brother of Ladislaus. He entered into an alliance with Meinhard, Count of Tyrol, which he cemented by the marriage of his eldest son Albert with Elizabeth, daughter of Meinhard. But his views were still more promoted by the general discontent which pervaded every part of the Austrian dominions, and by the anathemas of Philip, titular Duke of Carinthia and Archbishop of Salzburg, who absolved the people of his diocese from their oath of allegiance, and exhorted them to shake off the yoke of a tyrant and receive the chief of the empire.

The prelate made repeated exhortations to Rudolph to hasten his expedition. He drew a hideous picture of Ottocar's oppressions; expatiated on the discontents of the natives, and their inveterate hatred to the Bohemians, and used all his eloquence to encourage the King of the Romans to invade the country. "I observe," he says, "the countenances of your adversaries pale with terror; their strength is withered; they fear you unknown; your image is terrible in their imaginations; and they tremble even at the very mention of your name. How will they act, and how will they tremble when they hear the voice of the approaching thunder, when they see the imperial eagles rushing down on them like the flash of the lightning!"

The plan formed by Rudolph for the prosecution of the war was calculated to divide the forces and distract the attention of Ottocar. He himself was to penetrate into Bohemia, while his son was to invade Austria, and Meinhard of Tyrol to make a diversion on the side of Styria. To oppose this threatened invasion, Ottocar assembled a considerable army, sent a reënforcement to Henry of Bavaria, augmented the garrison of Klosterneuburg, a fortress deemed impregnable, fortified Vienna, and despatched a considerable party of his army toward Teppel to secure his frontier; but resigning himself to supineness and careless security, he passed that time, which should have been employed in repressing the discontented by his presence and rousing the courage of his troops, in hunting and courtly diversions.

Rudolph, apprised of these dispositions, changed his plan, marched against Henry of Bavaria, and compelled him, by force of arms, to desert the Bohemian alliance. He meditated a reconciliation between the Duke and his brother the Count Palatine, and, to secure his coöperation, gave his daughter Hedwige in marriage to Otho, son of Henry, with the promise of assigning a part of Upper Austria as a pledge of her portion. This success opened to him a way into Austria. Accompanied by Henry with a reënforcement of one thousand horses, he traversed Lower Bavaria, by Ratisbon and Passau; overran that part of Austria which lies to the south of the Danube, without resistance, was received with joy by the natives, and rapidly marched toward Vienna.

This well-concerted expedition bore rather the appearance of a journey than a conquest, and Ottocar, awakened from his lethargy, received the intelligence with astonishment and terror. He now found even his ally Henry, in whose assistance he had confided, serving with his enemies, his Austrian territories invaded by a powerful army, the people hailing the King of the Romans as their deliverer, and the adversary, whom he had despised and insulted, in the very heart of his dominions. In these circumstances he recalled his army from Teppel, and led them through the woods and mountains of Bohemia to Drosendorf, on the frontiers of Austria, with the hope of saving the capital. But his troops being harassed by the fatigues of this long and difficult march, and distressed for want of provisions, he was unable to continue his progress, while Rudolph, advancing along the southern bank of the Danube, made himself master of Klosterneuburg by stratagem, and encamped under the walls of Vienna. Here, being joined by Meinhard of Tyrol, who had overrun Styria and Carinthia, and drawn the natives to his standard, he laid siege to the city. The garrison and people, who were warmly attached to Ottocar and encouraged with the hopes of speedy relief, held out for five weeks; at length the want of provisions and the threats of Rudolph to destroy the vineyards excited a small tumult among the people, and the governor proposed a capitulation.

During this time the discontents in Ottocar's army increased with their increasing distress; he was threatened by the approach of the Hungarians toward the Austrian frontiers; he saw his own troops alarmed, dispirited, and mutinous; and he was aware that on the surrender of the capital Rudolph had prepared a bridge of boats to cross the Danube and carry the war into Bohemia. In this situation, surrounded by enemies, embarrassed by increasing difficulties, deserted or opposed by his nobles, his haughty spirit was compelled to bend; he sued for peace, and the conditions were arranged by the arbitration of the Bishop of Olmuetz, the Elector Palatine, and the Burgrave of Nuremberg. It was agreed, on the 22d of November, 1276, that the sentence of excommunication and deprivation which had been pronounced against Ottocar and his adherents should be revoked; that he should renounce all his claims to Austria, Styria, Carinthia, Carniola, and Windischmark; that he should take the oath of allegiance, do homage for the remainder of his territories to the head of the empire, and should receive the investiture of Bohemia, Moravia, and his other fiefs. An article was also inserted, by which Ottocar promised to deliver up to Ladislaus, King of Hungary, all the places wrested from him in that kingdom. To cement this union a double marriage was to be concluded between a son and daughter of each of the two sovereigns; Rudolph engaged to give a portion of forty thousand marks of silver to his daughter, and, as a pledge for the payment, assigned to Ottocar a part of that district of Austria which lies beyond the Danube. The peace being concluded, the city of Vienna opened its gates and readily acknowledged the new sovereign.

Ottocar was obliged to submit to these humiliating conditions, and on the 25th of November, the day appointed for doing homage, crossed the Danube with a large escort of Bohemian nobles to the camp of Rudolph, and was received by the King of the Romans, in the presence of several princes of the empire. With a depressed countenance and broken spirit, which he was unable to conceal from the bystanders, he made a formal resignation of his pretensions to Austria, Styria, Carinthia, and Carniola, and, kneeling down, did homage to his rival, and obtained the investiture of Bohemia and Moravia, with the accustomed ceremonies.