The Old Swiss Confederacy began as a late medieval alliance between the communities of the valleys in the Central Alps, at the time part of the Holy Roman Empire, to facilitate the management of common interests such as free trade and to ensure the peace along the important trade routes through the mountains. The Hohenstaufen emperors had granted these valleys reichsfrei status in the early 13th century. As reichsfrei regions, the cantons (or regions) of Uri, Schwyz, and Unterwalden were under the direct authority of the emperor without any intermediate liege lords and thus were largely autonomous. With the rise of the Habsburg dynasty, the kings and dukes of Habsburg sought to extend their influence over this region and to bring it under their rule; as a consequence, a conflict ensued between the Habsburgs and these mountain communities who tried to defend their privileged status as reichsfrei regions. The three founding cantons of the Schweizerische Eidgenossenschaft, as the confederacy was called, were joined in the early 14th century by the city states of Lucerne, Zürich, and Bern, and they managed to defeat Habsburg armies on several occasions. They also profited from the fact that the emperors of the Holy Roman Empire, for most of the 14th century, came from the House of Luxembourg and regarded them as potential useful allies against the rival Habsburgs. By 1460, the confederates controlled most of the territory south and west of the Rhine to the Alps and the Jura mountains. At the end of the 15th century, two wars resulted in an expansion to thirteen cantons (Dreizehn Orte): in the Burgundian Wars of the 1470s, the confederates asserted their hegemony on the western border, and their victory in the Swabian War in 1499 against the forces of the Habsburg emperor Maximilian I ensured a de facto independence from the empire. During their involvement in the Italian Wars, the Swiss brought the Ticino under their control. Two similar federations sprung up in neighboring areas in the Alps in the 14th century: in the Grisons, the federation of the Three Leagues (Drei Bünde) was founded, and in the Valais, the Seven Tenths (Sieben Zenden) were formed as a result of the conflicts with the Dukes of Savoy. Neither federation was part of the medieval Eidgenossenschaft but both maintained very close connections with it. Territorial development Under the Hohenstaufen dynasty of the Holy Roman Empire, the three