Built in the mid-17th century as a fortress of the Polish Potocki family, Stanisławów was annexed to the Habsburg Empire during the First Partition of Poland in 1772, after which it became the property of the State within the Austrian Empire. The fortress was slowly transformed into one of the most prominent cities at the foothills of the Carpathian Mountains. After World War I, for several months, it served as a temporary capital of the West Ukrainian People's Republic. Following Peace of Riga, Stanisławów became part of the Second Polish Republic. After the Soviet invasion of Poland at the onset of World War II, the city was annexed by the Soviet Union, only to be occupied by Nazi Germany two years later. With the liberation of Soviet Ukraine in 1944 and the shifting of borders, the Communist regime ran the city for the next four-and-a-half decades. A few years before the fall of the Soviet Union, the blue-yellow flag was raised in the city as the symbol of an independent Ukraine.