 On the other hand, Mömpelgard (Montbéliard) to the southwest of Alsace, belonging to the Counts of Württemberg since 1397, remained a Protestant enclave in France until 1793.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.