At the outset of World War II in September 1939, Denmark declared itself neutral, but that neutrality did not prevent Nazi Germany from occupying the country almost immediately after the outbreak of war; the occupation lasted until Germany's defeat. The decision to occupy Denmark was taken in Berlin on 17 December 1939. On 9 April 1940, Germany occupied Denmark in Operation Weserübung. The Danish government and king functioned in a relatively normal manner until 29 August 1943, when Germany placed Denmark under direct military occupation, which lasted until the Allied victory on 5 May 1945. Contrary to the situation in other countries under German occupation, most Danish institutions continued to function relatively normally until 1945. Both the Danish government and king remained in the country in an uneasy relationship between a democratic and a totalitarian system until 1943 when the Danish government stepped down in protest against German demands that included instituting the death penalty for sabotage.