The government of the Czarevna still persisted in its warlike projects. In return for an active cooperation against the Ottomans, Poland had consented to ratify the conditions of the Treaty of Androussovo, and to sign a perpetual peace (1686). A hundred thousand Muscovites, under the command of Prince Galitsyne, and fifty thousand Little Russian Cossacks, under the orders of the hetman Samoilovitch, marched against the Crimea (1687). The army suffered greatly in the southern steppes, as the Tartars had fired the grassy plains. Galitsyne was forced to return without having encountered the enemy. Samoilovitch was accused of treason, deprived of his command, and sent to Siberia; and Mazeppa, who owed to Samoilovitch his appointment as secretary-at-war, and whose denunciations had chiefly contributed to his downfall, was appointed his successor.
In the spring of 1689 the Muscovite and Ukranian armies, commanded by Galitsyne and Mazeppa, again set out for the Crimea. The second expedition was hardly more fortunate than the first: they got as far as Perekop, and were then obliged to retreat without even having taken the fortress. This double defeat did not hinder Sophia from preparing for her favorite a triumphal entry into Moscow. In vain Peter forbade her to leave the palace; she braved his displeasure and headed the procession, accompanied by the clergy and the images and followed by the army of the Crimea, admitted the generals to kiss her hand and distributed glasses of brandy among the officers. Peter left Moscow in anger, and retired to the village of Preobrajenskoe. The foreign policy of the Czarevna was marked by another display of weakness. By the Treaty of Nertchinsk she restored to the Chinese empire the fertile regions of the Amur, which had been conquered by a handful of Cossacks, and razed the fortress of Albazine, where those adventurers had braved all the forces of the East. On all sides Russia seemed to retreat before the barbarians.
Meanwhile Peter was growing. His precocious faculties, his quick intelligence, and his strong will awakened alike the hopes of his partisans and the fears of his enemies. As a child he only loved drums, swords, and muskets. He learned history by means of colored prints brought from Germany. Zotof, his master, whom he afterward made "the archpope of fools," taught him to read. Among the heroes held up to him as examples we are not surprised to find Ivan the Terrible, whose character and position offer so much analogy to his own. "When the Czarevitch was tired of reading," says M. Zabieline, "Zotof took the book from his hand and, to amuse him, would himself read the great deeds of his father, Alexis Mikhailovitch, and those of the Czar, Ivan Vasilievitch, their campaigns, their distant expeditions, their battles and sieges: how they endured fatigues and privations better than any common soldier; what benefits they had conferred on the empire, and how they extended the frontiers of Russia."