In the 15th century, much of what is now the German state of Thuringia, including the area around Eisenach, was in the hands of the Wettin dynasty, since 1423 Prince-electors of Saxony. In 1485, the Wettin lands were divided according to the Treaty of Leipzig, with most of the Thuringian lands going to Elector Ernest of Saxony and his descendants. The Ernestine Wettins also retained the title of Elector. However, when Ernest's grandson John Frederick the Magnanimous revolted against Emperor Charles V during the Schmalkaldic War, he was defeated at the 1547 Battle of Mühlberg and deprived of the electorate in favour of his Wettin cousin Maurice. According to the Capitulation of Wittenberg he was only allowed to retain the lands in Thuringia.