Since the 19th century both nations often shared a similar fate, and their history has sometimes intertwined. In the 19th century both were under the rule of foreign powers. Greece was ruled by the Ottoman Empire, and Poland was partitioned between Austria, Prussia (afterwards Germany) and Russia. Greece eventually regained independence during the Greek War of Independence in the 1820s, while several Polish 19th-century uprisings remained unsuccessful, and Poland regained independence only after World War I in 1918. In 1919 both countries officially established diplomatic relations. Both nations exchanged ambassadors in 1922. In 1937–1939, both ethnic Poles and Greeks in the Soviet Union were subjected to genocidal campaigns carried out by the NKVD, known as the "Polish Operation" and the "Greek Operation" respectively. Both countries were invaded and occupied during World War II — Poland by Germany and the Soviet Union, and Greece by Germany and Italy. In 1946, Greece entered into a civil war which saw over 14,000 Greeks migrate and find refuge in Poland after the communists in Greece were defeated in 1949. The Greeks settled predominantly in the Polish cities and towns of Zgorzelec, Wrocław, Bielawa, Bielsko-Biała, Dzierżoniów, Gdynia, Jelenia Góra, Katowice, Kraków (in the Nowa Huta district), Legnica, Lubań, Niemcza, Szczecin, Świdnica, Wałbrzych and Warsaw.