The model of a united nation was tested by the Helvetian Republic (1798–1803) imposed by Napoleon Bonaparte, who tried to make Switzerland a centralized nation. The republic abolished the domination of some cantons by others, all cantons became full partners in the confederation, and the first democratic parliament was established. The inadequacy of the centralized model rapidly became evident, and in 1803 Napoleon reestablished the federal organization. After the collapse of his empire in 1814, the twenty-two cantons signed a new federal pact (1815), and the neutrality of Switzerland was recognized by the European powers.
Tension among the cantons took the form of conflict between liberals and conservatives, between industrialized and rural cantons, and between Protestant and Catholic cantons. The liberals struggled for popular political rights and the creation of federal institutions that would allow Switzerland to become a modern state. The conservative cantons refused to revise the 1815 Pact, which guaranteed their sovereignty and gave them more power within the confederation than their population and economy warranted. This tension resulted in the civil war of the Sonderbund (1847), in which the seven Catholics cantons were defeated by federal troops. The constitution of the federal state provided a better means of integration for the cantons. The constitution of 1848 gave the country its present shape except for the creation of the canton of Jura, which separated from the canton of Bern in 1978.