Province of Alsace follows Prince-Bishopric of Strasbourg
This situation prevailed until 1639, when most of Alsace was conquered by France to keep it out of the hands of the Spanish Habsburgs, who by secret treaty in 1617 had gained a clear road to their valuable and rebellious possessions in the Spanish Netherlands, the Spanish Road. Beset by enemies and seeking to gain a free hand in Hungary, the Habsburgs sold their Sundgau territory (mostly in Upper Alsace) to France in 1646, which had occupied it, for the sum of 1.2 million Thalers. When hostilities were concluded in 1648 with the Treaty of Westphalia, most of Alsace was recognized as part of France, although some towns remained independent. The treaty stipulations regarding Alsace were complex. Although the French king gained sovereignty, existing rights and customs of the inhabitants were largely preserved. France continued to maintain its customs border along the Vosges mountains where it had been, leaving Alsace more economically oriented to neighbouring German-speaking lands. The German language remained in use in local administration, in schools, and at the (Lutheran) University of Strasbourg, which continued to draw students from other German-speaking lands. The 1685 Edict of Fontainebleau, by which the French king ordered the suppression of French Protestantism, was not applied in Alsace. France did endeavour to promote Catholicism. Strasbourg Cathedral, for example, which had been Lutheran from 1524 to 1681, was returned to the Catholic Church. However, compared to the rest of France, Alsace enjoyed a climate of religious tolerance.
France consolidated its hold with the 1679 Treaties of Nijmegen, which brought most remaining towns under its control. France seized Strasbourg in 1681 in an unprovoked action. These territorial changes were recognised in the 1697 Treaty of Ryswick that ended the War of the Grand Alliance. But Alsace still contained islands of territory nominally under the sovereignty of German princes and an independent city-state at Mulhouse. These enclaves were established by law, prescription and international consensus.