The history of the monarchy of the United Kingdom and its evolution into a constitutional and ceremonial monarchy is a major theme in the historical development of the British constitution. The British monarchy traces its origins to the petty kingdoms of Anglo-Saxon England and early medieval Scotland, which consolidated into the kingdoms of England and Scotland by the 10th century. Anglo-Saxon England had an elective monarchy, but this was replaced by primogeniture after England was conquered by the Normans in 1066. The Norman and Plantagenet dynasties expanded their authority throughout the British Isles, creating the Lordship of Ireland in 1177 and conquering Wales in 1283. In 1215, King John agreed to limit his own powers over his subjects according to the terms of Magna Carta. To gain