With the help of his maternal uncle Duke
Henry II of Brabant and the
Cologne archbishop
Konrad von Hochstaden, William was elected
king of Germany after
Emperor Frederick II was excommunicated by
Pope Innocent IV. He succeeded Landgrave
Henry Raspe of Thuringia who had died within a year after his election as
anti-king in 1246. The next year, William decided to extend his father's hunting residence to a palace which met his new status. This would later be called the
Binnenhof (
Inner Court) and was the beginning of the city of
The Hague. Meanwhile, after a siege of five months, William
besieged Aachen for six months before capturing it from Frederick's followers. Only then could he be crowned as king by Archbishop
Konrad of Cologne. He gained a certain amount of theoretical support from some of the German princes after his marriage to
Elizabeth, daughter of the
Welf duke
Otto of Brunswick-Lüneburg, on 25 January 1252. He was elected as King of the Romans a second time on 25 March 1252 at Brunswick. The
electors were the Archbishops of Cologne, Mainz and Trier, the Margrave of Brandenburg and the Duke of Saxony. The Count Palatine
Otto II, who was also Duke of Bavaria, was excluded from taking part in the election on the ground that, as a supporter of Conrad IV, he was under sentence of excommunication. After the election, the King of Bohemia sent ambassadors conveying his consent to it. However, although "William lacked neither courage nor chivalrous qualities... his power never extended beyond the Rhineland." In his home county, William fought with Countess
Margaret II of Flanders for control of Zeeland. As king of Germany, he made himself count of Zeeland. In July 1253, he defeated the Flemish army at
Westkapelle (in modern-day
Belgium) and a year later a pause in hostilities followed. His
anti-Flemish policy worsened his relationship with
France. From 1254 to his death he fought a number of wars against the
West Frisians. He built some strong castles in
Heemskerk and
Haarlem and created roads for the war against the Frisians. William gave city rights to
Haarlem,
Delft,
's-Gravenzande and
Alkmaar. According to the
Annales Wormatienses, on 10 November 1255 William "eliminated the rights of citizens who are called Pfahlbürger so that among other restrictions, none of the cities were permitted to have them or receive them"; a later scribe added a gloss to clarify that the
Pfahlburgers "were citizens who were not resident in the city". ==Marriage and issue==