place was the seat of the County of Weimar, first mentioned in 949, which was one of the most powerful jurisdictions in early Middle Ages Thuringia. In 1062 it was united with the County of Orlamünde to the new County of Weimar-Orlamünde, which existed until the Thuringian Counts' War in 1346. It fell to the Wettins afterwards. The Weimar settlement emerged around the count's wooden castle and two small churches, dedicated to Saint Peter (which later became the main church), and to Saint James, respectively. In 1240, the count founded the dynasty's monastery in Oberweimar, run by Cistercian nuns. Soon after, the counts of Weimar founded the town, which was an independent parish since 1249 and called civitas in 1254. From 1262, the citizens used their own seal. The regional influence of the Weimar counts was declining as the influence of the Wettins in Thuringia increased. Hence, the new small town was relatively marginal in a regional context, also due to the fact that it was located far from relevant trade routes, such as the Via Regia. The settlement around Saint James Church developed into a suburb during the 13th century. After becoming part of Wettin territory in 1346, urban development improved. The Wettins fostered Weimar by abolishing socage and granting privileges to the citizens. Now Weimar became equal to other Wettinian cities like Weißensee and grew during the 15th century, with the establishment of a town hall and the current main church. In 1438 Weimar acquired trade privileges for woad, a plant from which blue dye was made. The castle and the walls were finished in the 16th century, making Weimar into a full city. Early Modern Period After the Treaty of Leipzig (1485) Weimar became part of the electorate of the Ernestine branch of Wettins with Wittenberg as capital. The Protestant Reformation was introduced in Weimar in 1525; Martin Luther stayed several times in the city. As the Ernestines lost the Schmalkaldic War in 1547, their capital Wittenberg went also to the Albertines, so that they needed a new residence. As the ruler returned from captivity, Weimar became his residence in 1552 and remained as such until the end of the monarchy in 1918. The first Ernestine territorial partition in 1572 was followed by various ones, nevertheless Weimar stayed the capital of different Saxe-Weimar states. The court and its staff brought some wealth to the city, so that