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.