Beorhtric of Wessex (786–802) had probably received help from Offa of Mercia (757–796) in becoming king of Wessex. In 789 he married Eadburh, Offa's daughter. For the remainder of his rule Wessex was subordinate to Mercia. At the time Beorhtric became king, Egbert was also a claimant. Edgar was exiled for a time from Wessex and spent most of his time at the court of Charlemagne. On the death of Beorhtric Egbert returned and succeeded to the throne. At this time Coenwulf of Mercia (796–821) was king and he concluded a peace treaty with Wessex.