Switzerland came into being late in the thirteenth century as an alliance of three small cantons who declared their independence from the Hapsburgs. Over the centuries other cantons (including Lucerne, Zürich, and Bern) joined the confederation. After a defeat against France in the sixteenth century and through a number of attacks in the Thirty Years' War of the seventeenth century, the Swiss assumed a policy of neutrality in European politics. Switzerland enjoyed relative peace for a century and a half. Its pre-revolutionary stability is characterized in the account printed in the 4th edition of the Encyclopaedia Britannica published in 1797.
In 1798, however, Switzerland was occupied by Napoleon's armies, and renamed the Helvetic Republic. Switzerland's modern boundaries were established after Napoleon's fall in the Congress of Vienna (1815).