Nazism and communism are both extreme-left ideologies
World War II was deliberately prepared and provoked by the Soviet government since the 1920s, in what constituted perhaps the most ambitious, complex and successful strategic plan in all of human history. The very appearance of Nazism was an intermediate stage, not entirely foreseen in the original scheme, but quickly assimilated to give more solidity to the final results.
Reduced to misery by scorching indemnities and forced by the Versailles Treaty to disarm, Germany knew that in order to get its army back, it would have to be rebuilt in secret. But circumventing the oversight of the Western powers was impossible. Aid could only come from the USSR.
Meanwhile, Stalin, an unbeliever of the European revolutionary movements, thought of imposing communism on the West through military occupation. From this perspective, Germany naturally emerged as the ideal striker to weaken the opponent before a Soviet attack. That was why Stalin invested heavily in Germany's secret rearmament and gave up part of Soviet territory so that German troops could restructure there, away from Franco-British surveillance. From 1922 until 1939, the USSR illegally militarized Germany for the conscious purpose of unleashing a continental-sized war. The Second War was, from end to end, Stalin's creation.
The success of Nazism did not change the plan, but reinforced it. Stalin saw Nazism as an anarchic movement, good for creating confusion, but incapable of creating stable power. Hitler's rise was a perfect political and advertising complement to Germany's role in the military field. If the German army was going to break down the doors of the West for the entry of Soviet troops, the Nazi agitation would constitute, in Stalin's own expression, the “icebreaker” of the operation. Undermining European confidence in democracies, spreading chaos and panic, Nazism would create the necessary psychosocial conditions for communism, brought on the edge of Soviet bayonets with the support of local communist movements, to appear as a saving remedy.
In order to carry out the plan, Stalin had to act with prudent and fine machiavelism. He needed to strengthen Germany in the present, to precipitate it into a disaster in the future, and he needed to court the Nazi government at the same time that he was provoking the Western powers against it. Specialized in dialectical praxis, he conducted with astonishing precision this two-way policy in which lies the logical explanation of certain surface contradictions that at the time disoriented and scandalized the most naive militants.
For example, he promoted an intense anti-Nazi campaign in France, while helping Germany to militarize, organized the exchange of information and prisoners between the secret services of the USSR and Germany to settle internal oppositions in both countries and refused any substantive aid to German communists, allowing them, with a cynical smile, to be crushed by Nazi assault troops. The apparently paradoxical conduct of the USSR in the Spanish Civil War was also calculated within the same strategic conception.
Hitler, who until then was a pawn on Stalin's board, noticed the ruse and decided to turn the tables, invading the USSR. But Stalin was able to take advantage of the unforeseen, quickly shifting the tonic of world communist propaganda from pacifism to warmongering and anticipating the transformation, planned for much later, of facade anti-Nazism into armed anti-Nazism. In spite of the miscalculation that was soon corrected, the plan worked: Germany played its role as an icebreaker, went downhill, and the USSR rose to the position of the second dominant world power, militarily occupying half of Europe and installing the communist regime there.
[Translated from here]