During World War I, the German army refrained from attacking the Netherlands, and thus relations between the two states were preserved. At war's end in 1918, the former Kaiser Wilhelm II fled to the Netherlands, where he lived till his death in 1941. The German army occupied the Netherlands during World War II and kept the country under occupation in 1940–1945.