 Cossacks captured castle in 1648, but after the armistice it was occupied by the Poles and frequently resisted attacks by Cossacks, Turks and Tatars.In course of Polish–Ottoman War (1672–1676) Terebovlia castle became an important border fortress after the partition of Podolia by Turkey in 1671.Armistice in war followed by Treaty of Buchach which ultimately was rejected by Sejm of the Polish–Lithuanian Commonwealth and war resumed.