The Thirty Years' War devastated the city, and it would slowly decline for a period of time from then on. After the catastrophic defeat of the Protestant Heilbronn League by the Habsburgs at Nörlingen in 1634, Duke Eberhard III and his court fled in exile to Strasbourg, abandoning the Duchy to looting by pro-Habsburg forces. The Habsburgs once again had full reign of the city for another four years, and in that time Stuttgart had to carry the burden of billeting the pro-Habsburg armies in Swabia. Ferdinand III, King of the Romans, entered the city in 1634 and, two years later in 1636, once again attempted to re-Catholicize Württemberg. The next year, the Bubonic plague struck and devastated the population. The Duke returned in 1638 to a realm somewhat partitioned to Catholic factions in the region, and entirely ravaged by the war. In the Duchy itself, battle, famine, plague and war reduced the Duchy's population of 350,000 in 1618 to 120,000 in 1648 – about 57% of the population of Württemberg. Recovery would be slow for the next several decades, but began nonetheless with the city's first bookstore in 1650 and high school in 1686. This progress was almost entirely undone when French soldiers under Ezéchiel du Mas appeared outside the city's walls in 1688 during the Nine Years' War, but the city was saved from another sack due to the diplomatic ability of Magdalena Sibylla, reigning over Württemberg as regent for her son, Eberhard Ludwig.