In 1940 , Romania allied with the Axis powers and participated in the 1941 German invasion of the USSR .