and Mercia, and nearly conquered Wessex, but in that year the West Saxons achieved a decisive victory at the Battle of Edington under King Alfred the Great. By 883, Æthelred, Lord of the Mercians, had accepted Alfred's overlordship, and in the 880s and 890s the Anglo-Saxons ruled Wessex and western Mercia, but the rest of England was under Viking rule. Alfred died in 899 and was succeeded by his son, Edward the Elder. In the 910s Edward and Æthelflæd, Lady of the Mercians, who was his sister and Æthelred's widow, conquered Viking-ruled eastern Mercia and East Anglia. Æthelflæd died in 918 and the Mercians installed her daughter Ælfwynn as the second Lady of the Mercians, but Edward seized her and established full control over Mercia. When he died in 924, he controlled all of England south of the Humber. Edward was succeeded by his eldest son Æthelstan, who may have been king only of Mercia at first, but ruled the whole of his father's realm by the next year. In 927 he conquered Northumbria, and thus became the first king of all of England. He died in October 939 and was succeeded by his half-brother and Eadwig's father, Edmund, who was the first king to succeed to the throne of all England. He almost immediately lost control of the north when Anlaf Guthfrithson, the Viking king of Dublin, crossed the sea to become king of York (southern Northumbria). He then invaded Mercia and Edmund was forced to surrender north-east Mercia to him, but Guthfrithson died in 941. By 944, York was ruled by two Viking kings, Anlaf Sihtricson and Ragnall Guthfrithson, and in that year Edmund expelled them and recovered full control of England. On 26 May 946 he was stabbed to death trying to protect his seneschal from attack by a convicted outlaw at Pucklechurch in Gloucestershire, and as his sons Eadwig and Edgar were young children, their uncle Eadred became king. Like Edmund, Eadred inherited the kingship of the whole of England but soon lost it when York accepted a Viking leader as king. The sequence of events is unclear, but Eadred, Anlaf Sihtricson and Erik Bloodaxe ruled the kingdom of York at different periods until its magnates expelled Erik, and Northumbria became permanently part of England. Eadred then appointed Osulf, the Anglo-Saxon ruler of Bamburgh (northern Northumbria), as the earl of all Northumbria. Eadred died on 23