In 1937, the Trotskyists were expelled from the Socialist Party, an action which led to the formation of the Socialist Workers Party (SWP) at the end of the year. Inside the SWP, Burnham allied with Max Shachtman in a faction fight over the position of the SWP's majority faction, led by James P. Cannon and backed by Leon Trotsky, defending the Soviet Union as a degenerated workers state against the incursions of imperialism. Shachtman and Burnham, especially after witnessing the Nazi–Soviet pact of 1939 and the invasions of Poland, Latvia, Lithuania, and Estonia by Joseph Stalin's regime, as well as the Soviet invasion of Finland in November 1939, came to contend that the USSR was a new form of imperialistic class society and was thus not worthy of even critical support from the socialist movement.