Alfred the Great and the Danelaw. When Alfred became King of Wessex in 871, the Viking Great Army had already destroyed every other English kingdom, and Wessex itself stood on the edge. In the winter of 878 a Danish surprise attack drove him into the Somerset marshes, where, the chroniclers say, he sheltered at Athelney, burned the peasant's cakes, and gathered his strength. In May he came out of the marsh, raised the levies of three shires, and broke the Danish army at Edington. The Danish leader Guthrum accepted baptism and withdrew to rule the conquered north and east - the territory that became the Danelaw.
Alfred spent the rest of his reign making sure it could never happen again. He ringed his kingdom with burhs, fortified market towns planned on grids - Winchester, Oxford, Wallingford, Wareham - garrisoned and placed so that no part of Wessex lay more than a day's march from refuge. He divided his army so that half was always in the field, and built longships of his own design to meet the raiders at sea. When the last great Viking army came in the 890s, it found a kingdom that could not be broken, and gave up.
What made Alfred unique among warrior kings was that he fought for the mind as well. Lamenting that learning had collapsed with the monasteries, he gathered scholars to his court and himself translated the essential books into Old English: Boethius, Augustine, Gregory the Great, and Bede's history. He began the Anglo-Saxon Chronicle, the first continuous national history in a European vernacular, and issued a law code joined to the laws of his ancestors. He is the only English king called the Great, and he earned it in the schoolroom as much as on the battlefield.
The Danelaw outlasted its conquerors: for two centuries eastern England lived under Danish law, its towns - Derby, Leicester, Lincoln, Nottingham, Stamford - and its place-names ending in -by and -thorpe still marking the settlement. But Alfred's kingdom endured, and his house united England. His grandson Athelstan was the first king of all the English, and Alfred's burhs, laws and chronicle became the foundations of the English state.