Estonia's fights for freedom during the twentieth century were in large part a reaction to nearly 700 years of foreign rule. Before 1200 the Estonians lived largely as free peasants loosely organized into parishes (kihelkonnad ), which in turn were grouped into counties (maakonnad ). In the early 1200s, the Estonians and the Latvians came under assault from German crusaders seeking to impose Christianity on them. Although the Estonians' resistance to the Teutonic Knights lasted some twenty years, the deficiency of a centralized political organization as well as inferior weaponry eventually brought down the Estonians in 1227. The Germans, moving from the south, were abetted by Danish forces that invaded from the north and captured Tallinn. Together with present-day Latvia, the region became known as Livonia; the Germans and Danes settled down as nobility, and the Estonians were progressively subordinated as serfs. During 1343-45 an Estonian peasant uprising against the German and Danish nobility prompted the Danes to relinquish their control of northern Estonia to the Germans. After this resistance was crushed, the area remained generally peaceful for two centuries.
Commerce developed rapidly because Estonia's larger urban centers at the time--Tallinn, Tartu, Pärnu, and Narva--were all members of the Hanseatic League, an organization accomplished by merchants of various, mostly German, cities to protect their mutual trading interests. Still, foreign rivalries over the strategic Livonian region began to reemerge in the mid-sixteenth century as the fighting capacity of the Germans diminished and that of neighboring Muscovy began to increase. The ensuing twenty-five-year fight for control of Livonia was precipitated by an invasion by Ivan IV (the Terrible) (r. 1533-84) in 1558. The advancing Russians wiped out the disintegrating forces of the Teutonic Knights and nearly succeeded in conquering the whole area. Swedish and Polish intervention reversed the Russian gains and forced Ivan eastward, back behind Lake Peipsi. Peace between Sweden and Poland in Livonia was also slow in coming, with Sweden eventually winning most of the territory by 1629. By this time, decades of war had caused huge population losses (in some areas, over 50 %), affecting urban and rural areas alike.
The Bolshevik takeover in Petrograd in November 1917 extended to Estonia as well, until Germany occupied Estonia in February 1918. Most of Estonia's other political parties realized they were caught between the two forces and agreed to begin an active search for outside support. Representatives were sent to the major European capitals to secure Western recognition of an Estonian declaration of freedom. As the Bolsheviks retreated from Tallinn and the German occupation army entered the city, the Committee of Elders (or standing body) of the Maapäev declared the nation independent on February 24, 1918.