In 1806, William I was dispossessed by Napoleon Bonaparte for his support of the Kingdom of Prussia. Kassel became the capital of a new Kingdom of Westphalia with Napoleon's brother Jérôme Bonaparte as king. The elector was restored following Napoleon's defeat in 1813, and although the Holy Roman Empire was now defunct, William retained his title of Elector, as it gave him pre-eminence over his cousin, the Grand Duke of Hesse. From 1813 onwards, the Electorate of Hesse was an independent country and, after 1815, a member of the German Confederation.