The foreign policy of Russia during XVII century was aimed at solving three major tasks: gaining an outlet to the Baltic Sea, securing the southern borders from the attacks of the Crimean Khan and returning of the territories seized during the Distempered Time.
As a result of Stolbovsky Peace Treaty 1617 with Sweden and Deulinsky Armistice 1618 with Rech Pospolitaya Russia lost vast terries. For a long time the major knot of contradictions was represented by the relations between Russia and Rech Pospolitaya. The efforts of the government of Patriarch Filaret in 20's and at the beginning of 30's were directed at creation of the anti-polish coalition including Sweden, Russia and Turkey.
The martial line of policy against Poland proclaimed by Zemsky Council in 1622 appeared in the 10-year-long economic assistance to the enemies of Rech Pospolitaya - Denmark and Sweden. The death of the Polish King Sigizmund III in the spring of 1632 provided favourable conditions to brake out the war for Smolensk. Indecision and sluggishness of the government and voevodes M.B. Shein and A.V. Izmaylov resulted in an 8-month's exhausting siege of Smolensk.
The news about incursion of the Crimean Tatars into the southern areas of Russia, and the wave of riots of soldiers, villeins and peasants demoralized the army. The army of Vladislav IV, a new king of Poland, that came to Smolensk in August 1633 put an end in the campaign of the Russians. As a result of the court intrigues the voevodes who led the campaign paid for the failure with their lives. In June 1634 Russia and Poland signed Polyanovsky Peace Treaty. Under the treaty Vladislav at last abandon a claim for the Russian throne.
The defeat in the Smolensk War bound the foreign activity of the Moscow government. In 1637 the Don Cossacks under their own initiative seized a Turkish fortress of Azov. Active attempts of the Turks to return Azov forced the Cossacks to ask assistance of the Russian government in 1641. Having Azov under the patronage of Moscow would open an outlet to the Azov and the Black Seas. However, Zemsky Council taking into account the lack of preparation of the country to an inevitable military conflict with the Osmanian Empire, refused the aid to the Cossacks and offered to give Azov back.
In 30's the government took measures on strengthening of defensibility of the country. Already during the Smolensk War the first steps of reorganization of the armed forces were carried out. The value of ineffective home guard formed by noblemen was reducing, while soldiers' and riders' troops became the basic military force. Erection of strong defensive lines and fortresses at the southern borders began in 1635 to restrain the attacks of the Crimean Tatars. In 30-40's 29 new towns were founded and made up the southern protecting line (Kozlov, Tambov, Chuguyev, Yablonev, etc.).
Russian-Polish relations still remained the crucial question in the Russian foreign policy at the middle of XVII century. The liberation struggle of the Ukrainian people which started in 1648 under the direction of B. Khmelnitskiy against the Polish rule stirred up the national-wide movements in Byelorussia and Smolenshina. Zemsky Council October 1, 1653 in Moscow resolved to reunite Ukraine with Russia. The reunion of two sister nations was proclaimed in solemn tones. The war against Rech Pospolitaya lasted 13 years (1654 - 1667). In the campaign of 1654 the Russian armies captured Smolensk and 33 towns of the East Byelorussia. The Polish armies were unprepared to the war, whereas the Russian troops were strongly supported by the Byelorussian population. In the summer of 1655 liberation of Ukraine and Byelorussia was going to an end - the main body of the Polish army was broken.
In 1655 the Swedish King Charles X intruded into Poland and captured a significant part of its northern territories. Aggressive plans of Sweden did not end at this point - Charles X laid the claims to all Lithuania and Byelorussia, including the territories already occupied by the Russian troops. An outstanding Russian diplomat and statesman A.L. Ordin-Nashchokin headed a new party in the government that considered the war with Sweden for an outlet to the Baltic Sea more important than continuation of a struggle against Poland. So, on May 17, 1656 Russia declared war to Sweden and in the summer of the same year the Russian army set off in the direction of Riga.
On October 24, 1656 Russia and Rech Pospolitaya concluded an armistice. All the moot territorial points remained open and both parties united for the joint actions against the Swedish army. Initial successes of the Russians finished with an unavailing siege of Riga. Russia failed to achieve any further progress in the struggle against Sweden.
In 1658 Poland renewed military actions against Russia.
In 1661 after three years of negotiations Kardissky Peace Treaty was signed between Russia and Sweden. The treaty restored the pre-war borders of the countries. The question of an outlet to the Baltic Sea was postponed for a long time.
The War with Pech Pospolitaya got a lingering character. Neither party could obtain decisive success. The peace talks began in 1661 and finished by signing of Andrusovskoye Armistice on January 30, 1667. The terms of which where secured in 1686 by a peace treaty. As a result Russia gained Smolenshina, the left-bank Ukraine and Kiev. Byelorussia remained under Poland. Besides, the treaty provided for the joint actions of Russia and Poland against possible Turk-Crimean aggression.
From the beginning of 70's and up to the end of XVII century the main task in the foreign policy of Russia became a question of relations with the Crimea and Turkey. In the summer of 1677 a 60-thousand strong Turkish army laid siege to the political centre of the left-bank Ukraine - the fortresses Chigirin. 12 thousand in number garrison of Chigirin under the command of I.I. Rzhevsky showed heroic resistance. And with the help of the Russian-Ukrainian army of G.G. Romodanovsky the Turks were crashed under Buzhin. A year after the Osmans besieged Chigirin again. They managed to capture the fortress but failed to crush the Russian army that had retreated in an organized manner. The further battles did not bring any success to the Turks, so, they had to retreat. On January 13, 1681 a 20 years armistice was signed in Bakhchisarai.
Austria and Poland, having refused to help Russia in the struggle against the Turkish-Crimean aggression, now faced a real menace themselves. "The Sacred League" consisting of Austria, Poland and Venice under the patronage of the Pope was formed in 1684. The consent to enter "the Sacred League" was used by the head of the Moscow government V.V. Golitsin to accelerate the signing of the peace treaty with Poland in 1686 and to get considerable territorial concessions to Russia. In 1687 and 1689 Russian troops carried out two campaigns against the Crimean Khanate that was in allegiance to Turkey. Prince V.V. Golitsyn was appointed the commander.
The Crimean campaigns brought Russia neither outstanding military successes, nor territorial gains. Nevertheless, the Russian troops blocked the forces of the Crimean Khan who, thus, could not render assistance to the Turkish army when it suffered defeats from the Austrians and Venetians. Besides, inclusion of Russia into a European military union enhanced the international prestige of Russia considerably. The important event in the foreign policy of Russia at the end of XVII century was a conclusion of the first Russian-Chinese treaty 1689 in Nerchinsk.