Most of the English kingdoms, being in turmoil, could not stand against the Vikings, but King Alfred of Wessex defeated Guthrum's army at the Battle of Edington in 878. There followed the Treaty of Wedmore the same year and the Treaty of Alfred and Guthrum in 886. These treaties formalised the boundaries of the English kingdoms and the Viking Danelaw territory, with provisions for peaceful relations between the English and the Vikings. Despite these treaties, conflict continued on and off. However, Alfred and his successors eventually drove back the Viking frontier and retook York.