On October, 24, 1648, the Treaty of Westphalia ended The Thirty Years' War in the Holy Roman Empire, and Switzerland gained its independence. From the article:
"Thirty Years’ War and independence
History of Switzerland
The Confederation stayed out of the war, with only the Associated Place of Graubünden being drawn into the hostilities. The Thirty Years’ War ended for the Confederation with its separation from the Holy Roman Empire of the German Nation.
The Thirty Years’ War
The Thirty Years’ War was both a religious as well as a territorial conflict. The alliances did not remain stable throughout the war, but in essence one could say that it was a war between the Holy Roman Empire and its Catholic allies on the one hand, and the other European powers on the other. In the 17th century, the Holy Roman Empire was ruled by the Habsburgs, who also ruled Spain. France was eager to see the Empire weakened and, although Catholic, joined with the Protestants.
The Confederation was able to keep out of the war largely because of the complex set of alliances the various member cantons had established in the 16th century. These alliances fell largely along confessional lines. Both sides realised that involvement in the war would pull the Confederation apart
However, in 1633 and 1638 there were violations of neutrality by Protestant forces. The Confederation responded by setting up a military council (both Catholic and Protestant), able if necessary to send up to 36,000 soldiers to the border. This agreement called for the common defence, known as the "Defensionale of Wil".
" Compared with other German lands, this country [Switzerland] seemed to me as foreign as if I had been in Brazil or China. I saw people going peacefully about their business; the stables were full of cows; chickens, geese and ducks ran around the farmyards; the roads were safe for travellers, the taverns were full of people making merry, no man was an enemy, none were in fear of losing their property, let alone their life... so that I regarded this land as an earthly paradise. ." Der Abenteuerliche Simplicissimus Teutsch (1668) by Hans Jakob Christoffel von Grimmelshausen (ca. 1621-76)
Graubünden in the Thirty Years' War
Graubünden, which was not yet a full member of the Confederation but an Associated Place, was strongly affected by the Thirty Years' War. This was partly because of its geographical position, and partly because of its administrative structure and religious composition.
All the warring parties wanted to control the link between Austria and northern Italy (both ruled by the Habsburgs). This also included the mountain passes in Graubünden. Whoever controlled the Alpine passes could regulate the troop movements on this north-south axis.
At the time of the Thirty Years' War, Graubünden consisted of a loose federation of three regions, which made the whole area vulnerable to attacks from outside.
In addition, Graubünden was divided along religious lines. The Valtellina in the south was predominantly Catholic and fought against the Protestant supremacy of the other areas. In the so-called "Veltellina Murders" of 1620, Catholics from Valtellina – with the support of Spanish soldiers – massacred many of their Protestant neighbours.
This event triggered intervention by the Great Powers, whereupon the Valtellina changed hands several times. One of the best-known local leaders was the Protestant pastor Jörg [George] Jenatsch (1596-1639). Together with French troops, he drove the Austrians from Valtellina. However, when he realized that the French wanted to retain sovereignty over the Valtellina, Jenatsch converted to Catholicism and joined an alliance with the Habsburgs for the expulsion of the French. He was assassinated in 1639, but his aim of preserving the Valtellina for Graubünden was achieved.
The Peace of Westphalia
Although the Confederates were not directly involved in the Thirty Years' War, they ended up the main beneficiary – all the European powers formally recognised Swiss independence.
This was not least due to the efforts of Basel mayor Johann Rudolf Wettstein (1594-1666, elected in 1645 as mayor of the city of Basel). On his own initiative, Wettstein took part in the negotiations for the Peace of Westphalia in Münster and Osnabrück in 1646/47.
As ambassador of the Swiss Confederation, he initially had no official legitimacy. After lengthy, demanding and skillful negotiations, he achieved the detachment of the Confederation from the Holy Roman Empire of the German Nation in 1648."