Prehistoric Ukraine, as a part of the Pontic steppe in Eastern Europe, played an important role in Eurasian cultural events, including the spread of the Chalcolithic and Bronze Ages, Indo-European migrations, and the domestication of the horse.
Ukraine, a part of Scythia in antiquity, and settled by the Greuthungi and Getae in the migration period, was also a site of early Slavic expansion. It entered written history with the establishment of the medieval state of Kievan Rus', which emerged as a powerful nation in the Middle Ages but disintegrated by the mid-12th century.
During the 14th and 15th centuries, present-day Ukrainian territories came under the rule of four external powers: the Golden Horde, the Crimean Khanate, the Grand Duchy of Lithuania and the Crown of the Kingdom of Poland. The latter two would then merge into the Polish–Lithuanian Commonwealth following the Union of Krewo and Union of Lublin. Meanwhile, the Ottoman Empire emerged as a major regional power in and around the Black Sea, through protectorates like the Crimean Khanate, as well as directly-administered territory.
After a 1648 rebellion of the Cossacks against the Polish–Lithuanian Commonwealth, Hetman Bohdan Khmelnytsky agreed to the Treaty of Pereyaslav in January 1654. The exact nature of the relationship established by this treaty between the Cossack Hetmanate and Russia remains a matter of scholarly controversy. The agreement precipitated the Russo-Polish War of 1654–67 and the failed Treaty of Hadiach, which would have formed a Polish–Lithuanian–Ruthenian Commonwealth. In consequence, by the Treaty of Perpetual Peace, signed in 1686, the eastern portion of Ukraine (east of the Dnieper River) was to come under Russian rule, 146,000 rubles were to be paid to Poland as compensation for the loss of right-bank Ukraine, and the parties agreed not to sign a separate treaty with the Ottoman Empire. The treaty was strongly opposed in Poland and was not ratified by the Polish–Lithuanian Sejm until 1710. The legal legitimacy of its ratification has been disputed.