Switzerland's neutrality was established well before the war, and was codified in the Hague Convention of 1899. This convention outlined the rights and obligations of neutral countries in times of war, and Switzerland was one of the first countries to sign it.
During the war, Switzerland took a number of steps to uphold its neutrality. These included:
* Avoiding alliances with any of the belligerent states
* Refusing to allow foreign troops or military supplies to pass through its territory
* Providing refuge for people fleeing the fighting
Switzerland's neutrality was not always easy to maintain. The country was under pressure from both sides of the war to join the fight, and there were a number of incidents in which Swiss territory was violated. However, Switzerland was ultimately successful in maintaining its neutrality throughout the war.
Switzerland's neutrality has been widely praised, and has been cited as a model for other neutral countries in times of war. It has also been criticized, with some arguing that it was too isolationist and that Switzerland could have done more to help the Allied forces. However, there is no doubt that Switzerland's neutrality played an important role in protecting the country from the devastation of World War II.