In 1469, following the Treaty of St. Omer, Upper Alsace was sold by Archduke Sigismund of Austria to Charles the Bold, Duke of Burgundy. Although Charles was the nominal landlord, taxes were paid to Frederick III, Holy Roman Emperor. The latter was able to use this tax and a dynastic marriage to his advantage to gain back full control of Upper Alsace (apart from the free towns, but including Belfort) in 1477 when it became part of the demesne of the Habsburg family, who were also rulers of the empire. The town of Mulhouse joined the Swiss Confederation in 1515, where it was to remain until 1798.