The canton of Bern was one of the three cantons that presided over the Tagsatzung (former executive and legislative council) together with Lucerne and Zurich. The capital of the canton was chosen as the federal capital in 1848, mainly due to its proximity to the Francophone area of the country.
The restoration of power in Switzerland was only temporary. After a period of unrest with repeated violent confrontations, such as that of Züriputsch in 1839, civil war broke out in 1847 when some of the Catholic cantons tried to establish an alliance between themselves ( Sonderbundskrieg).  The war lasted less than a month, causing fewer than 100 casualties, most of whom were due to friendly fire. The Sonderbundskrieg seems very small compared to other conflicts that existed in 19th century Europe and in the history of Swiss society.
The war showed the residents of Switzerland the need for unity to strengthen themselves against their European neighbors. Swiss from all walks of life, whether they were Catholic, Protestant, Liberal or Conservative, realized that the cantons would progress further if they merged their economic and religious interests.
Thus, while the rest of Europe was in the midst of revolutions and wars, the Swiss enacted a more modern constitution, which gave the government a federal design, largely inspired by the American model. This constitution imposed a central authority, leaving the cantons the right to govern themselves and resolve local issues. Furthermore, the national assembly was divided into an upper house (the Swiss Council of States, with two representatives for each canton) and a lower house(Swiss National Council, with elected representatives from all over the country). To introduce changes to the constitution, a referendum became mandatory.
A unique system of weights and measures was also introduced, and in 1850 the Swiss franc became the only official currency in the country. Article 11 of the constitution prohibited the sending of troops abroad, although in 1860 the Swiss army was forced to participate alongside Francis II of the Two Sicilies at the siege of Gaeta.
One of the most important clauses of the constitution was the one that established that it could be completely rewritten if the occasion demanded it, in this way the constitution would totally evolve instead of being modified year after year. This feature of the constitution became very useful with the advent of the Industrial Revolution, when several proclaimed that it was time to modify the constitution. A first draft was rejected by the population in 1872, but two years later the modifications were accepted.  It was here that an optional referendum was introduced for the creation and modification of laws at the federal level. Norms were also established that regulated the army, commerce and other legal matters. Finally, in 1891, the constitution was revised again and an unusual system of direct democracy was introduced, which remains unique to this day. 
As a country located in Europe according to INTERNETSAILORS, Switzerland was not invaded in either of the two world wars. During the First World War, Switzerland gave asylum to Vladimir Illych Ulyanov (Lenin) where he remained until 1917. In 1917 the neutrality of Switzerland was seriously questioned by the scandal carried out by Robert Grimm and Arthur Hoffmann, when they tried to create a truce between Russia and Germany. However, in 1920, Switzerland joined the League of Nations, which had its headquarters in Geneva, on the sole condition that it would be free from all military requirements.
During World War II, the German army made detailed invasion plans,  but never invaded Switzerland.  The country was able to maintain its independence thanks to a combination of military deterrents, concessions to Germany, and very good luck in the military operations that delayed the German invasion. There were also attempts by the Swiss Nazi Party to annex the country to Germany, but they failed. The Swiss press harshly criticized the Third Reich, frequently insulting its leader. Switzerland was an important espionage base for both sides during the conflict, in addition to often acting as a mediator in communications between the two sides. Allies and Axis forces. The Geneva-based International Red Cross played a very important role during this and other conflicts.
Trade in Switzerland was blocked by the Allies and the Axis countries. Economic cooperation and the expansion of credit for the Third Reich varied according to the risk of invasion and the availability of other trading partners. The concessions peaked after a railway line connecting the country to Vichy France was cut off, leaving Switzerland completely surrounded by the Axis. During the war, Switzerland received more than 300,000 refugees, of which 104,000 were from foreign troops, who were accepted according to the Rights and Obligations of neutral countries, a document signed at the Hague Conferences of 1899 and 1907 ; 60,000 of the refugees were civilians fleeing persecution by the Nazis. Of these, about 27,000 were Jews. However, strict immigration and asylum policies, as well as financial relations with Nazi Germany, generated controversy.  During the war, the Swiss Air Force fought aircraft from both sides. In May and June 1940, they shot down eleven Luftwaffe planes that had invaded Swiss airspace, forcing other intruder craft to retreat after a policy change in relations with Germany. More than one hundred Allied bombers and their crews were housed during the war. In 1944, the Allies mistakenly bombed the towns of Schaffhausen (killing forty people), Stein am Rhein, Vals and Rafz (with eighteen dead), as well as Basel and Zurich on March 4, 1945.
In 1959, women received the right to vote in some cantons, which became federal law in 1971.  In 1963, Switzerland joined the Council of Europe. At the end of the 1970s, a part of the canton of Bern separated and created the new canton of Jura. In 1984, Elisabeth Kopp was the first woman on the Swiss Federal Council and it was in 1999 that the first woman, Ruth Dreifuss, became president. On April 18 of that same year the Swiss population voted in favor of a complete revision of the federal constitution. 
In 2002, Switzerland became a full member of the UN, leaving the Vatican City as the only recognized state that does not have a full UN membership. Switzerland was one of the founders of EFTA, but is not a member of the European Economic Area (EEA). An application for membership was sent to the European Union in May 1992, but did not proceed when access to the EEA was rejected in a referendum in December of that year.  Since then, multiple referendums and votes have been held on Switzerland’s accession to the European Union, but due to various reactions from the population, the process of obtaining membership has stopped. However, Swiss law has gradually changed to conform to what the European Union and the Swiss government claim are a series of bilateral agreements. Switzerland and Liechtenstein have been totally surrounded by the European Union since Austria’s accession in 1995. On June 5, 2005, 55% of Swiss voters agreed to join the Schengen Treaty., a result that has been cataloged by the European Union as a sign of support from Switzerland, a country that is traditionally perceived as independent or isolationist.