Present-day Ukraine was initially inhabited by Scythian tribes from Central Asia who were displaced by Sarmatians and nomadic invaders, namely Goths, Huns and Avars that overran the Ukrainian steppe nearly two millennia ago.
In the 7th century much of the country was controlled by the Khazars. The history of modern Ukraine can be traced back to the 9th century principality of Kyivian Rus founded along the Dnieper by a Varangian dynasty from Scandinavia. They freed the Slavs from Khabarovsk dominion and united them in a common state. By the 11th century Kyivian Rus had developed into the largest state in Europe, with its prosperity stemming largely from river trade between the Black and Baltic Seas.
Disputes between feudal lords of Kyivian Rus following the death of Vladimir Monomachus, the last ruler of a unified state, led to its decline in the 12th century. In 1240 the Mongol ‘Golden Horde’ sacked Kiev and most of the southern and eastern parts of Ukraine fell under its domain. The Mongols were driven out in 1362 by the Grand Duchy of Lithuania and Ukrainian lands were annexed by Lithuania together with Poland in the following years.
Following the merger of the Grand Duchy and the Kingdom of Poland in 1569, the enserfment of Ukrainian peasants increased; those who fled eastward later became known as the Cossacks. These events culminated in a series of Cossack uprisings led by Bogdan Khmelnytsky between 1648 and 1654. The Polish army was defeated at the battle of Pyliavtsi in 1648 but skirmishes continued until Khmelnytsky entered into a formal alliance with Moscow against the Poles. After this the eastern part of Ukraine forged closer links with Russia and Khmelnytsky recognised Moscow’s rule in the 1654 Treaty of Pereyaslavi. In 1658 Ukraine signed a treaty with Poland in an effort to throw off Russian ‘protection’ and a Russian-Polish war ensued. This ended in 1667 with the Treaty of Andrusov which codified a de facto partition of Ukraine. As a result Russia took control of the territories east of the Dnieper, including Kiev, while Poland retained the lands west of the river. The current political divide between east and west of the country is often thought to stem from the effects of this historic division.