Because of a lack of money in the late days of the disastrous Thirty Years' War, the "Great Elector Frederick William of Brandenburg in about 1640 mortgaged the Schwedt region to the Baltic German noble Gustav Adolf von for the sum 25,000 Thalers. His second wife, Electress Sophia Dorothea, daughter of Duke Philip of Schleswig-Holstein-Sonderburg-Glücksburg, personally re-acquired the territory for 26,500 Thalers shortly after the birth of her first son Prince Philipp William. Dorothea dedicated herself to the reconstruction of the Renaissance castle at Schwedt, which had been devastated in the Thirty Years' War, as well as to the economic development of the town and its surroundings. Dutch experts and French Huguenots were invited to cultivate tobacco in the Spring of 1686. By the end of the 18th century, the Uckermark, with an area of 44 km², was the largest coherent tobacco-producing region in the Holy Roman Empire. Its three cigar factories were the most important economic driving forces in the region. For financial safeguarding of her sons, she later also purchased the Lordship of Wildenbruch and further estates. Upon the death of his mother in 1689, Philipp William and his brothers inherited a vast territory including three towns, three castles, 33 villages, and 24 farmsteads. In 1692 he came to terms with his elder half-brother Elector Frederick III in 1692, obtained a considerable severance payment and the title of a "Margrave of Brandenburg-Schwedt"; intensively cultivating his dominions and furnishing his castle in a Baroque style at great expense. His younger brotherAlbert Frederick became a general lieutenant and Grand Master of the Order of Saint John; the third-born, Charles Philip likewise became an officer and shortly before his death secretly married the Piemontese noblewoman Caterina di Balbiano, who called herself Madame de Brandebourg as a widow. The youngest of Dorothea's sons was Margrave Christian Ludwig, officer and administrator of Halberstadt, the honoree of Bach's Brandenburg Concertos. The brisk building activity was continued by Philipp William's son and successor, Margrave Frederick William. Initially under the tutelage of his uncle Frederick he ruled his dominions from 1731 onwards and began to develop Schwedt into a country seat for the cadet line. In 1734 he had married his cousin Princess Sophia Dorothea of Prussia, a sister of King Frederick the Great. As he left no male heirs upon his death, Philip William's youngest son, Frederick Henry ruled as the last Margrave of Brandenburg-Schwedt and developed Schwedt into a cultural center. Known for his numerous love affairs, his marriage with Princess Leopoldine Marie of Anhalt-Dessau likewise produced no male descendants. After Frederick Henry's death in 1788, the male line of Brandenburg-Schwedt became extinct and their appanage territories reverted to the King of Prussia. For a few years, beginning in 1794, the castle of Schwedt was the residence of King Frederick William II of Prussia's second son, Prince Frederick Louis Charles of Prussia. The last Schwedt heiress Elisabeth Louise, daughter of Margrave Frederick William, died in 1820.