Poland, during the early middle ages, operated on the very fringes of the Holy Roman Empire. Because of this, little is known of its political history before 966, when its rulers were baptised. In the following period the country, initially a duchy, maintained a loose relation with the Empire, sometimes as a vassal, sometimes as an ally. In 1025 Duke Boleslaw the Brave was crowned the first King of Poland, and independence was firmly established. Unfortunately, there was only about a century of this, partly marred by civil wars between siblings. Boleslaw III thought a more lasting peace could be achieved by giving all, rather than one, of his male children a part of his Kingdom. He hoped this would create harmony between the four brothers rather than bloodshed. Unfortunately, he was wrong: after Boleslaw's death in 1038 the Kingdom fell apart in four different pieces that essentially became independent duchies.
Poland remained fractured until the end of the 13th century. By then, two major events had taken place. Firstly, the Mongol invasion had devastated the Polish countryside after the defeat of the Polish army at Liegnitz. The severity and extent of the destruction is still debated, but it was most likely responsible for the second event: the German 'Ostsiedlung'. In the wake of the Mongol invasion, part of Poland was depopulated, and many German settlers moved east. As in Bohemia and the shores of the Baltic, they were hoping to turn from serfs in Germany to respectable freemen beyond the Empire's borders, and they helped revive agricultural production and crafts in some areas, as well as creating or (re-)populating Polish cities. The German institutions and town laws influenced many aspects of Polish urban life, as German laws were often held to be more advanced than the local variants and copied. Because of this it is sometimes hard to differentiate between Germans and Germanised Poles. There was also an influx of Jews, who were welcomed with open arms at about the same time they were banished from England by Edward I.
Wladyslaw I became King in 1320 and spearheaded another period of unification, partly with foreign assistance. His son Kazimierz (Casimir) III 'the Great' made even more of an impression. Reigning from 1330 on, he can be compared to the Emperor and King of Bohemia Karel IV. Kazimierz, too, founded an important and lasting university, at Krakow in 1364, maKing it one of the first of such centres of learning north of the Alps. And despite a desperate situation at the beginning of his reign, when he was under threat from both Bohemia and the Teutonic Order, the King not only managed to keep them at bay, but also managed to expand his Kingdom by the time of his death. He left no male heir.
The Kingdom of Poland was united with the Grand Duchy of Lithuania in something of a surprise move, when the 'King' Jadwiga cancelled her engagement with Sigismund of Luxembourg, who would later become Emperor, and married Grand Duke Jogaila in stead. This event prevented the personal union of the Holy Roman Empire and Poland and no doubt contributed to the country's lasting political independence. The union with Lithuania, meanwhile, strengthened Poland's military with the addition of the skilled Lithuanian nobility. These were more lightly armed than their Polish equivalents and had in part copied their tactics from the Mongols. Together, the two countries fought against the Teutonic Order and inflicted a very major defeat on it in 1410 at Grunwald or Tannenberg. The battle had no direct political repercussions, although it coincided with the beginning of a permanent drop in western volunteers flocKing to the Order. More wars were fought, however, and by the end of the century the Grand Master of the Teutonic Order had become no more than a vassal of Poland.
By the end of the 15th century, then, Poland had successfully defeated or negated its most important enemies: the Empire was no longer encroaching on Poland's border from the west and the north, the Teutonic Order had ceased to exist, the Lithuanian Grand Duchy in the East was a close ally in a dynastic union and the Mongol threat was gone for good. Poland had survived the middle ages, but the future was to offer many more crises to be overcome.