Until the 20th century, different states at various times controlled the lands of modern-day Belarus, including Kievan Rus', the Principality of Polotsk, the Grand Duchy of Lithuania, the Polish–Lithuanian Commonwealth, and the Russian Empire. In the aftermath of the Russian Revolution in 1917, different states arose competing for legitimacy amidst the Civil War, ultimately ending in the rise of the Byelorussian SSR, which became a founding constituent republic of the Soviet Union in 1922. After the Polish-Soviet War, Belarus lost almost half of its territory to Poland. Much of the borders of Belarus took their modern shape in 1939, when some lands of the Second Polish Republic were reintegrated into it after the Soviet invasion of Poland, and were finalized after World War II. During World War II, military operations devastated Belarus, which lost about a quarter of its population and half of its economic resources. The republic was redeveloped in the post-war years. In 1945, the Byelorussian SSR became a founding member of the United Nations, along with the Soviet Union.