Before the founding of the People's Republic of China, the Kuomintang, also known as the Chinese Nationalist Party, led by Chiang Kai-shek, was ruling China and strongly opposed the Communist Party of China. On 12 April 1927, Chiang Kai-shek purged the communists in what was known as the Shanghai massacre which led to the Chinese Civil War. Initially, the Kuomintang had success in doing so until a full-scale invasion of China by Japan forced both the Nationalists and the Communists into an alliance. After the war, the two parties were thrown back into a civil war. The Kuomintang were defeated in the mainland and went into exile in Taiwan while the rest of China became Communist in 1949.