The history of Estonia forms a part of the history of Europe. Humans settled in the region of Estonia near the end of the last glacial era, beginning from around 8500 BC. Before German crusaders invaded in the early 13th century, proto-Estonians of ancient Estonia worshipped spirits of nature.[citation needed] Starting with the Northern Crusades in the Middle Ages, Estonia became a battleground for centuries where Denmark, Germany, Russia, Sweden and Poland fought their many wars[1] over controlling the important geographical position of the country as a gateway between East and West.[citation needed]
After Danes and Germans conquered the area in 1227, Estonia was ruled initially by Denmark in the north, by the Livonian Order, an autonomous part of the Monastic state of the Teutonic Knights and by Baltic German ecclesiastical states of the Holy Roman Empire. From 1418 to 1562 the whole of Estonia formed part of the Livonian Confederation. After the Livonian War of 1558-1583, Estonia became part of the Swedish Empire until 1710/1721, when Sweden ceded it to Russia as a result of the Great Northern War of 1700-1721. Throughout this period the Baltic-German nobility enjoyed autonomy, and German served as the language of administration and education.
The Estophile Enlightenment Period (1750–1840) led to the Estonian national awakening in the middle of the 19th century. In the aftermath of World War I (1914-1918) and the Russian revolutions of 1917, Estonians declared their independence in February 1918. The Estonian War of Independence (1918-1920) ensued on two fronts: the newly proclaimed state fought against Bolshevist Russia to the east and against the Baltic German forces (the Baltische Landeswehr) to the south. The Tartu Peace Treaty (February 1920) marked the end of fighting and recognised Estonian independence in perpetuity.
In 1940, in the wake of the Molotov–Ribbentrop Pact of 1939, the Soviet Union occupied Estonia and (according to e.g. the US,[2] the EU,[3] and the European Court of Human Rights[citation needed]) illegally annexed the country. In the course of Operation Barbarossa, Nazi Germany occupied Estonia in 1941; later in World War II the Soviet Union reoccupied it (1944). Estonia regained independence in 1991 in the course of the dissolution of the Soviet Union and joined the European Union and NATO in 2004.