In the aftermath of the 1917 Russian Revolution, different states arose competing for legitimacy amidst the Civil War, ultimately ending in the rise of the Byelorussian Soviet Socialist Republic (Byelorussian SSR) which became a founding constituent republic of the Soviet Union in 1922. Belarus lost almost half of its territory to Poland after the Polish–Soviet War (1919–1921). 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 WWII, 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 and the Ukrainian SSR. The parliament of the republic proclaimed the sovereignty of Belarus on 27 July 1990, and during the dissolution of the Soviet Union, Belarus declared independence on 25 August 1991. In 2000, Belarus and Russia signed a treaty for greater cooperation, forming the Union State.