In 58 B.C. the Helvetii who inhabited the country (see Helvetia) were conquered by the Romans. Invaded (5th cent. A.D.) by the Alemanni and by the Burgundii, the area passed to the Franks in the 6th cent. Divided (9th cent.) between Swabia and Transjurane Burgundy, it was united (1033) under the Holy Roman Empire. The expanding feudal houses, notably Zähringen and Kyburg, were supplanted (13th cent.) by the houses of Hapsburg and of Savoy. Hapsburg encroachments on the privileges of the three mountainous localities of Uri, Schwyz, and Unterwalden resulted in the conclusion (1291) of a defensive league among them. The legendary hero of this event is William Tell. The league triumphed at Morgarten (1315) and, joined by Lucerne, Zürich, Zug, Glarus, and Bern, decisively defeated the Hapsburgs at Sempach (1386) and Näfels (1388).
In the 15th cent. the Swiss league rose to the first rank as a military power. The conquest of Aargau, Thurgau, and the valleys of Ticino, which were ruled as subject territories until 1798, was followed by Swiss victories over Charles the Bold of Burgundy (1476–77) and over Emperor Maximilian I, who in 1499 granted Switzerland virtual independence. By 1513, the admission to the confederation of Fribourg, Solothurn, Basel, Schaffhausen, and Appenzell had raised the number of cantons to 13, and this number was maintained until 1798. The conquest by Bern of Vaud from Savoy (1536), and close alliances with the Grisons, Geneva, St. Gall, and other towns and regions, further increased the Swiss orbit, but Switzerland's importance as a European power was broken in 1515 when the French defeated the Swiss at Marignano (see also Italian Wars).
A "perpetual alliance" with France (1516) and neutrality became the basis of Swiss policy. Swiss mercenaries, however, continued to serve abroad for three centuries (see Swiss Guards). The cantons, loosely bound by a federal diet and by individual treaties and often torn by internal feuds, were seriously split by the Reformation, preached by Zwingli at Zürich and by Calvin at Geneva. The Catholics, led by the Four Forest Cantons, defeated the Protestants in battle; the Treaty of Kappel (1531) preserved Catholicism in Lucerne, Uri, Schwyz, Unterwalden, Zug, Fribourg, and Solothurn. National unity almost disappeared for more than two centuries, but religious divisions did not prevent the Swiss (except the Grisons) from remaining neutral throughout the Thirty Years War. Switzerland was an island of prosperity when, in 1648, at the end of the war, its formal independence was recognized in the Peace of Westphalia.
In the following century and a half, government in many cantons became the exclusive business of a small oligarchy. While Switzerland became insignificant politically in the 18th cent., its wealth steadily increased, and its scientists and writers (von Haller, von Mühler, Pestalozzi, Rousseau) made it an intellectual center. The Swiss oligarchies strongly opposed the French Revolution. Invading French armies established the Helvetic Republic (1798–1803) and in 1799 clashed with Austrian and Russian forces. Napoleon's Act of Mediation (1803) partially restored the old confederation, and, at the Congress of Vienna, the Pact of Restoration (1815) substantially reestablished the old regime, except that the confirmation of nine new cantons brought the total to its present number.
By the Treaty of Paris (1815), Swiss neutrality was guaranteed for all time. A subsequent economic depression, which caused large-scale emigration to North and South America, and generally reactionary rule contributed to widely successful demands for revision of the cantonal constitutions and the rise of the Radical party, which favored greater centralization. Opposition to centralization centered in the Catholic rural cantons, which in 1845 formed the Sonderbund, a defensive alliance. After a brief and almost bloodless civil war (1847) the victorious Radicals transformed the confederation into one federal state under a new constitution adopted in 1848 (and recast in 1874). National unity grew, and much socialist legislation (such as railroad nationalization and social insurance) was enacted.
Armed neutrality was maintained throughout World Wars I and II. Switzerland was a member of the League of Nations, and although it has long participated in many activities of the United Nations, it did not become a UN member until 2002 for fear that its neutrality would be compromised. From 1959 Switzerland was governed by a four-party coalition that began as a center-right coalition and subsequently became a broader grouping. Also in 1959 Switzerland became a member of the European Free Trade Association (EFTA); in 1972 it signed an industrial free-trade agreement with the European Community (EC; since 1993 the European Union).
In the 1950s, French-speaking inhabitants of the Jura region of Bern canton unsuccessfully demanded, with some violence, the creation of a Jura canton. In 1977 a constitution was accepted, and in 1979 it officially became the twenty-third canton of the Swiss Confederation. In 1971, after a referendum was passed by male voters, women were given the right to vote and be elected at the federal level; subsequently, Elisabeth Kopp of the Radical Democratic party became the first woman government minister (1984–88).
In a 1986 plebiscite, a parliamentary proposal to join the United Nations was rejected by Swiss voters. In 1992, Swiss voters also rejected participation in the European Economic Area, an EFTA-EC common market, but did approve joining the World Bank and International Monetary Fund. The rejection of the European Economic Area led to negotiations that resulted in a package of accords that established closer economic links with the European Union; voters approved the agreements in 2000.
Following charges that stolen assets deposited in Swiss banks by Nazis during World War II had not been properly returned, the country's two largest banks agreed in 1998 to pay $1.25 billion to the families of Holocaust victims; the banks had been facing lawsuits in the United States and were under international political pressure. Ruth Dreifuss, Switzerland's first woman president, served in the annually rotated post during 1999. In elections in 1999, the right-wing, nationalist People's party made sizable gains; this was regarded in part as a reaction to international criticism of Switzerland's role in World War II
Despite the turn to the right, Swiss voters in 2002 approved joining the United Nations, becoming the one of the last nations to seek membership in that organization (only Vatican City is not a member). In the 2003 and 2007 elections the People's party made further gains, becoming the largest party in the national council. In 2011 the People's party again won the largest share of the vote, but it was less than in 2007.