In 1544 the Tarnopol Castle was completed and repelled the first Tatar attacks. On 20 January 1548, Tarnopol was granted legal rights by the King of Poland Sigismund I the Old which allowed the town to hold three fairs annually, and the weekly trades on Mondays. Tarnopol received Magdeburg city rights two years later from Jan Tarnowski, regulating the duties of town residents. In 1548 the King of Poland also gave permission to create a pond near the Tarnopol suburb of Kutkovets. In 1549 the city managed to survive a Tatar siege by efforts of the Polish Duchess Eudokia Czartoryska (see House of Czartoryski). After the death of the Crown Hetman in 1561, Tarnopol became the property of his son Jan Krzysztof Tarnowski, who died childless in 1567. Starting in 1567 the city was owned by the daughter of Crown Hetman Zofia Tarnowska who was married to Konstanty Wasyl Ostrogski. In 1570 she died in childbirth, and Tarnopol was passed to the Ostrogski family. In 1575 it was plundered by the Tatars. In 1623 the city passed to the Zamoyski family. In 1589 Tarnopol was visited by the Austrian diplomat Erich Lassota von Steblau [de] who also mentioned the city's castle.
With the ongoing 1648-1654 Khmelnytsky Uprising, many residents of the city joined the ranks of the Khmelnytsky forces particularly during the 1649 Siege of Zbarazh that is located just 20 km (12 mi). In September 1655 the united army of Muscovite and Ukrainian Cossack forces occupied Ternopil among other cities as it was moving towards Lwow (Lviv).
The region was part of Habsburg Galicia and was an ethnic mix of mainly Roman Catholic Poles, Greek Catholic Ruthenians, and Jews. Intermarriage between Poles and Ruthenians was common. Church of St. Mary of the Perpetual Assistance was consecrated in 1908 with its main tower reaching 62 m (203 ft). In 1954 the church was blown up by Communist authorities and in its place was built the city's central supermarket. During World War I the city passed from German and Austrian forces to Russia several times. In 1917 the city and its castle were burnt down by fleeing Russian forces. After the dissolution of the Austro-Hungarian Empire, the city was proclaimed as part of the West Ukrainian People's Republic on 11 November 1918. After Polish forces captured Lwów during the Polish-Ukrainian War, Tarnopol became the country's temporary capital (22 November to 30 December 1918). After the act of union between the West Ukrainian Republic and the Ukrainian People's Republic (UPR), Ternopol formally passed under the UPR's control. On 15 July 1919, the city was captured by Polish forces. In 1920 the exiled Ukrainian government of Symon Petlura accepted Polish control of Tarnopol and of the entire area after receiving the assurance of Józef Pi?sudski, the Lithuanian born Field Marshal of the Polish Army, that there would be no peace with the Russians without creating a Ukrainian state. In July and August 1920 the Red Army captured Tarnopol in the course of the Polish-Soviet War. The city then served as the capital of the Galician Soviet Socialist Republic. Although the Poles and their Ukrainian allies badly defeated the Russians on the battle field and the Russians had offered to cede Ukraine and Belarus, Polish politicians in Warsaw refused to honor Pi?sudski's promise. By the terms of the Riga treaty, the Soviets and Poles effectively partitioned Ukraine. For the next 19 years, the ethnically mixed Ternopol area remained in Polish control.
From 1922 to September 1939, Tarnopol served as the capital of the Tarnopol Voivodeship that consisted of 17 powiats. According to the Polish census of 1931, individuals speaking Ukrainian/Ruthenian accounted for 46% of the Tarnopol Voivodeship, while Polish speaking population consisted of 49%. The city itself consisted of 77.7% Poles, 14.0% Jewish and 8.05% Ukrainian/Ruthenian population. After World War II, Communist Party historians reported that Edward Szturm de Sztrem, the pre-war chairman of the Polish census statistical office, admitted that the census returns, particularly those from the south-east, had been altered at the executive level. Another account stated that he admitted "that officials had been directed to undercount minorities, especially those in the eastern provinces".
At the onset of World War II, the Soviet invasion of Poland began on September 17, 1939. The Red Army entered eastern Poland in furtherance of the secret Molotov-Ribbentrop Pact and contrary to the Soviet-Polish Non-Aggression Pact. Tarnopol was captured, renamed Ternopol, and incorporated into the Ukrainian Soviet Socialist Republic under Ternopol Oblast. The Soviets made it their first priority to decimate Polish intelligentsia and destroy Polish culture. Ukrainian nationalist leaders were imprisoned. Mass arrests, torture and executions of Ukrainians and Poles and Jews followed. The Soviets also carried out mass deportations of the "enemies of the working class" to Kazakhstan. In practice, this translated into members of the former state administration, police, border service and land and business owners, Christians and Jews alike.
On 2 July 1941, the city was occupied by the Nazis who led the Jewish pogrom, assisted by local Ukrainians. Several thousand Jews were murdered until the Germans ordered the pogram stopped.  Between then and July 1943 when the entire Jewish population had been murdered, 10,000 Jews were murdered in the local environs by Germans and Ukrainians, another 6000 were rounded up and sent to Belzec extermination camp, and a few hundred others to labor camps. During most of this time Jews lived in the Tarnopol Ghetto. Many Ukrainians were sent as forced labour to Germany.
In the years 1942-1943, the Polish Armia Krajowa was active opposing Nazi rule and defending ethnic Poles from violence from Ukrainian Nationalists. During the Soviet offensive in March and April 1944, the city was encircled. In March 1944, the city was declared a fortified place (Gates to the Reich) by Adolf Hitler, to be defended until the last round was fired. The stiff German resistance caused extensive use of heavy artillery by the Red Army on March 7-8, resulting in the complete destruction of the city and killing of nearly all German occupants (55 survivors out of 4,500). Unlike many other occasions, where the Germans had practised a scorched earth policy during their withdrawal from territories of the Soviet Union, the devastation was caused directly by the hostilities. Finally, Ternopol was occupied by the Red Army on 15 April 1944. After the second Soviet occupation, 85% of the city's living quarters were destroyed. Due to heavy destruction, the regional seat was moved to Chortkiv.
Following the defeat of Nazi Germany, the ethnic Polish population of Tarnopol and its region was forcibly deported to postwar Poland and settled in, and near Wroc?aw (among other locations), as part of Stalinist ethnic cleansing in the Soviet Ukraine. In the following decades, Ternopol was rebuilt in a typical Soviet style and only a few buildings were reconstructed.
Polish Jews settled in Ternopil beginning at its founding and soon formed a majority of the population. During the 16th and 17th centuries there were 300 Jewish families in the city. The Great Synagogue of Ternopil was built in Gothic Survival style between 1622 and 1628.
After the first partition of Poland, Ternopil came under Austrian domination. Nevertheless, Joseph Perl was able to continue his efforts to improve the condition of the Jews, which he had begun under the Russian rule. In 1813 he established a Jewish school which had as its chief object the instruction of Jewish youth in German as well as in Hebrew and in various other subjects. Controversy between the traditional Hasidim and the modernising Maskilim which this school caused, resulted four years later in a victory for the latter, whereupon the institution received official recognition and was placed under communal control. Starting in 1863, the school policy was gradually modified by Polish influences, and very little attention was given to instruction in German. The Tempel für Geregelten Gottesdienst, opened by Perl in 1819, also caused dissensions within the community, and its rabbi, Samuel Judah Löb Rapoport, was forced to withdraw. This dispute also was eventually settled in favour of the Maskilim. As of 1905, the Jewish community numbered 14,000 in a total population of 30,415. Jews took control of the active import/export trade with Russia conducted through the border city of Pidvolochysk. In 1939, the Jewish population was 18,500.
In September 1941, the Germans announced the creation of the Tarnopol Ghetto for Jews still remaining in the city. In the winter of 1941-42,
mortality in the ghetto escalated to such a degree that the Judenrat was forced to bury the dead in a common grave. Between August 1942 to June 1943 there were 5 "selections" that depleted the Jewish population of the ghetto by sending the Jews to Belzec extermination camp. A few hundred Jews from Tarnopol and its vicinity attempted to survive by hiding within the town limits. Many were denounced to the Germans, including some 200 people shortly before the Soviets liberated the area. A number of Jews survived by hiding with the Poles. A monument in memory of the Holocaust victims was built at Petrikovsky Yar in 1996. On September 19, 2012, the monument was desecrated, in what seems to be an anti-Semitic act.
^Sergey R. Kravtsov, "Gothic Survival in Synagogue Architecture of Ruthenia, Podolia and Volhynia in the 17th-18th Centuries," Architectura. Zeitschrift für Geschichte der Baukunst/ Journal of the History of Architecture, vol. 1 (2005), 70.
^ ? ? [Ternopil authorities insist on restoration of military units in western Ukraine]. Ukrainian Independent Information Agency (in Ukrainian). 16 April 2014. Archived from the original on 4 February 2016. Retrieved 2016.