In August 1939 , Germany and the Soviet Union signed the Molotov-Ribbentrop Pact , a non-aggression treaty with a secret protocol .
Just before the war , Germany and the Soviet Union signed Molotov-Ribbentrop pact , agreeing that they would not attack each other for ten years .