The area where the Kremlin now stands was probably settled by the 11th century, but the founding of Moscow is traditionally ascribed to Yury Dolgoruky, Prince of Suzdal, who is recorded as giving a feast here in 1147. In 1237-38 Moscow was sacked, along with the rest of the Vladimir-Suzdal realm, by Tatars led by Batu, Genghis Khan's grandson. These Tatars set up a capital at Saray on the southern Volga and became known as the Golden Horde. Moscow, near river trade routes, became a princedom in its own right, and emerged as the Golden Horde's chief northern tribute collection point. It wasn't until the late 15th century, under Prince Ivan III (the Great) that Moscow could cease paying tribute to the Horde. Ivan brought Italian architects to build cathedrals in the Kremlin and styled himself 'Ruler of all Russia'. By the end of Ivan's reign, Moscow's control stretched from Novgorod in the west to Tula in the south, towards the Urals in the east and to the Barents Sea in the north.
Ivan IV (the Terrible) expanded Muscovite territory by launching the conquest of Siberia and winning control of the Volga region. By 1571 the city had over 200,000 people and was one of the biggest in the world. The Prime Minister, Boris Godunov, faced famine and a Polish-backed invasion. The seven years after his death were the Time of Troubles, characterised by civil war, invasions and a Polish occupation of Moscow. The Poles were finally driven out by Cossack soldiers and 16-year-old Mikhail Romanov was elected tsar by a council of nobles, launching the 300-year Romanov dynasty and a period of consolidation during which Moscow's territory spread southwards.
Peter the Great toured Europe in 1697-98. He built a new capital, St Petersburg, on the Baltic to open Russia up to Western trade and ideas and to consolidate military victories over Sweden. He disliked Moscow, where as a boy he had seen his uncle and his mother's advisers killed in a palace coup. He forced the nobility to move to St Petersburg and wear Western-style clothes and slapped a tax on beards - a symbol of the old, inward-looking Russia. However, Moscow remained important enough to be Napoleon's main goal when his troops marched on Russia in 1812. After the bloody Battle of Borodino, 130km (81mi) west of the city, the Russians abandoned Moscow and allowed Napoleon to march in and install himself in the Kremlin. The night he arrived Muscovites torched the city, including the stores. With winter coming, the French had to pull out little more than a month after they had arrived. Immediately, Moscow was feverishly rebuilt and the city's population swelled.