In 1772, after the First Partition of Poland, the city came under Austrian rule. In 1809, after the War of the Fifth Coalition, the city came under Russian rule, incorporated into the newly created "Ternopol krai". In 1815 the city (then with 11,000 residents) returned to Austrian rule in accordance with the Congress of Vienna. In 1820 Jesuits expelled from Polatsk by the Russians established a gymnasium in Tarnopol. In 1843 the last city's owner Jerzy Michal of Turkul sold the city to its residents for 175,000 florins. In 1870 the Galician Railway of Archduke Charles Louis connected Tarnopol with Lemberg in Austria-Hungary, accelerating the city's growth. At that time Tarnopol had a population of about 25,000.