The Zaporizhian Host, in order to leave the Polish–Lithuanian Commonwealth, sought a treaty of protection with Russia in 1654. This agreement was known as the Treaty of Pereyaslav. Commonwealth authorities then sought compromise with the Ukrainian Cossack state by signing the Treaty of Hadiach in 1658, but—after thirteen years of incessant warfare—the agreement was later superseded by the 1667 Polish–Russian Treaty of Andrusovo, which divided Ukrainian territory between the Commonwealth and Russia. Under Russia, the Cossacks initially retained official autonomy in the Hetmanate. For a time, they also maintained a semi-independent republic in Zaporozhia, and a colony on the Russian frontier in Sloboda Ukraine.
Khmelnytsky secured the military protection of the Tsardom of Russia in exchange for allegiance to the Tsar. An oath of allegiance to the Russian monarch from the leadership of the Cossack Hetmanate was taken, shortly thereafter followed by other officials, the clergy and the inhabitants of the Hetmanate swearing allegiance. The exact nature of the relationship stipulated by the agreement between the Hetmanate and Russia is a matter of scholarly controversy. The council of Pereiaslav was followed by an exchange of official documents: the March Articles (from the Cossack Hetmanate) and the Tsar's Declaration (from Muscovy).