Mercia was the dominant kingdom in southern England in the eighth century and maintained its position until it suffered a decisive defeat by Wessex at the Battle of Ellandun in 825. Thereafter the two kingdoms became allies, which was to be an important factor in English resistance to the Vikings. In 865 the Danish Viking Great Heathen Army landed in East Anglia and used this as a starting point for an invasion. The East Anglians were forced to pay off the Vikings, who invaded Northumbria the following year. They appointed a puppet king in 867, and then moved on Mercia, where they spent the winter of 867–868. King Burgred of Mercia was joined by King Æthelred of Wessex and his brother, the future King Alfred, for a combined attack on the Vikings, who refused an engagement; in the end the Mercians bought peace with them. The following year, the Danes conquered East Anglia, and in 874 they expelled King Burgred and, with their support, Ceolwulf became the last King of Mercia. In 877 the Vikings partitioned Mercia, taking the eastern regions for themselves and allowing Ceolwulf to keep the western ones. In early 878 they invaded Wessex, and many West Saxons submitted to them. Alfred, who was now king, was reduced to a remote base in the Isle of Athelney in Somerset, but the situation was transformed when he won a decisive victory at the Battle of Edington. He was thus able to prevent the Vikings from taking Wessex and western Mercia, although they still occupied Northumbria, East Anglia and eastern Mercia.