in both the Netherlands and France. The Neuburg cadet branch of the Palatinate branch also held the Duchy of Jülich and Berg from 1614 onwards: When the last duke of Jülich-Cleves-Berg died without direct heirs in 1609, the War of the Jülich succession broke out, ended by the 1614 Treaty of Xanten, which divided the separate duchies between Palatinate-Neuburg and the Margraviate of Brandenburg. Jülich and Berg fell to the Wittelsbach Count Palatine Wolfgang William of Neuburg. In 1619, the Protestant Frederick V, Elector Palatine became King of Bohemia but was defeated by the Catholic Maximilian I, Elector of Bavaria, a member of the Bavarian branch. As a result, the Upper Palatinate had to be ceded to the Bavarian branch in 1623. When the Thirty Years' War concluded with the Treaty of Münster (also called the Peace of Westphalia) in 1648, a new additional electorate was created for the Count Palatine of the Rhine. During their exile Frederick's sons, especially Prince Rupert of the Rhine, gained fame in England. The house of Palatinate of Zweibrücken-Kleeburg as heir to the Swedish throne ruled simultaneously the duchy of Bremen-Verden (1654–1719). In 1685, the Simmern line died out, and the Catholic Philip William, Count Palatine of Neuburg inherited the Palatinate (and also Duke of Jülich and Berg). During the reign of Johann Wilhelm (1690–1716) the Electoral residence moved to Düsseldorf in Berg. His brother and successor Charles III Philip, Elector Palatine moved the Palatinate's capital back to Heidelberg in 1718 and then to Mannheim in 1720. To strengthen the union of all lines of the Wittelsbach dynasty Charles Philip organized a wedding on 17 January 1742 when his granddaughters were married to Charles Theodore of Palatinate-Sulzbach and to the Bavarian prince Clement. In the imperial election a few days later Charles III Philip voted for his Bavarian cousin Prince-Elector Charles Albert. After extinction of the Neuburg branch in 1742, the Palatinate was inherited by Duke Charles Theodore of the branch Palatinate-Sulzbach. After the extinction of the Bavarian branch in 1777, a succession dispute and the brief War of the Bavarian Succession, the Palatinate-Sulzbach branch under Elector Charles Theodore succeeded also in Bavaria. With the death of Charles Theodore in 1799 all Wittelsbach land in Bavaria and the Palatinate was reunited under Maximilian IV Joseph, a member of the branch Palatinate-Zweibrücken-Birkenfeld. At the time there were two surviving branches of the Wittelsbach family: Palatinate-Zweibrücken