The Ottoman Empire that developed under the administration of Köprülü family captured Podalia from Poland. Then, they established dominion over Kazakhs and intended to expand towards Ukraine. This attempt caused the first great battle between the Russians and Ottomans in the year of 1678. A big army under the command of Merzifonlu Kara Mustafa Pasha encountered the army of the Crimean Khan Murad Giray (1678-1683) and it captured and destroyed the castle of Çigrin in Ukraine after a severe battle. The Kazakhs had been subdued under the dominion of the Ottoman State. But this domination did not live long. In the course of the great retreat that started with the defeat of Vienna, all the lands captured in that period were lost. The Russians participated in the holy alliance established in Europe (1684), and they started their attacks to the Crimea and the castle of Azov. Until that period, the Moscow tsars had abstained from an attack against the Ottoman Empire. However, from that date on, the attacks and invasions of tsars began directly towards the Crimea, Black Sea, the Caucasus and the Balkans. Before dealing with this period that ended with the annexation of the Crimean Khanate to the Russian Empire, we should mention about the cooperation of the khanate under the domination of Hajji Selim Giray (he was enthroned as the khan for four times between the years of 1671-1704) with the Ottoman State that had a vital importance in the course of the war years.

The successful defence of the Crimean people against the Russian attempts to invade the Crimea and the repulse of the attacks organised by the Polish forces in Bessarabia saved the Ottomans from a great trouble in the first disastrous years of the war. Furthermore, the Crimean forces repulsed the Habsburg army in the strait of Kacanik in Srbija in the year of 1688 and this repulse constituted the turning point in the progress of the war. Ottoman State had found the proper opportunity to repulse and exile the enemies from the Balkans. Hajji Selim Giray maintained his position of domination for a long time against the grand viziers and the rulers that were frequently changed until the end of the war. Thus, he gained a superior influence in the state affairs in Istanbul. Moreover, the ruler had taken his selection of vote in the course of the election of the grand vizier. Selim Giray established the union and stability in the management and administration of the war through these manners and he doubtlessly was the effective factor in the protection of the empire from terrible calamities.