In 1236, during another short stay in Germany, Frederick in person led the imperial army against Frederick II., duke of Austria, who had defied and overcome his representatives; having taken possession of Vienna and the Austrian duchies he there secured the election of his son Conrad, who had already succeeded his brother as duke of Swabia, as king of the Romans (May 1237). But in spite of these imposing displays of power the princes looked with suspicion upon an emperor who was almost a stranger to their country and who was believed to be a renegade from their faith, and soon after Frederick's return to Italy the gulf between him and his German subjects was widened by his indifference to a great danger which threatened them. This came from the Mongols who ravaged the eastern frontiers of the country, but the peril was warded off by the efforts of Henry II., duke of Silesia, who lost his life in a fight against these foes near Liegnitz in April 1241, and of Wenceslaus I., king of Bohemia.
The emperor's attitude with regard to the Mongol invasion is explained by events in Italy where Frederick was engaged in a new and, if possible, a more virulent struggle with the Lombard cities and with Gregory IX. As usual, the course of politics in Germany, which at this time was ruled by King Conrad and by the regent Siegfried, archbishop of Mainz (d. 1249), was influenced by this quarrel. Frederick of Austria had allied himself with Wenceslaus of Bohemia, and spurred on by the papal emissary had tried to set up a rival king; but both the Danish and the French princes who were asked to accept this thankless position declined the invitation, and Frederick and Wenceslaus made their peace, the former receiving back his duchies. After the defeat of the Mongols, however, there was again the danger of a rebellion based upon a union between the princes and the pope. Siegfried of Mainz deserted his master, and visiting Germany in 1242 Frederick found it necessary to purchase the support of the towns by a grant of extensive privileges; but, although this had the desired effect, Conrad could make but little headway against the increasing number of his enemies. At last the Papacy found an anti-king. Having declared Frederick deposed at the council of Lyons in 1245, Gregory's successor, Innocent IV., induced a number of princes to choose as their king the landgrave of Thuringia, Henry Raspe, who had served as regent of Germany. This happened in May 1246, and the conduct of the struggle against the _Pfaffenkönig_, as Henry was called, was left to Conrad, who was aided by the Bavarians, until February 1247, when the anti-king died. The papal party then elected William II., count of Holland, as Henry Raspe's successor, and during the state of anarchy which now prevailed in Germany the emperor died in Italy in December 1250.