Moray (Middle Irish: Muréb; Medieval Latin: Moravia; Old Norse: Mýræfi) was a province within the area of modern-day Scotland, that may at times up to the 12th century have operated as an independent kingdom or as a power base for competing claimants to the Kingdom of Alba. It covered a much larger territory than the modern council area of Moray, extending approximately from the River Spey in the east to the River Beauly in the north, and encompassing Badenoch, Lochaber and Lochalsh in the south and west.
Moray emerged in the 10th century as a successor to the dominant Pictish kingdom of Fortriu. The status of its rulers was ambiguous: being described in some sources as mormaers, in others as Kings of Moray, and in others as Kings of Alba. The ruling kin-group of Moray, sometimes called the House of Moray, attained the throne of Alba between 1040 and 1058 in the person of Mac Bethad mac Findláich (Shakespeare's Macbeth) and his stepson Lulach. After Lulach was killed and succeeded by Máel Coluim mac Donnchada of the House of Dunkeld, Lulach's son Máel Snechtai and grandson Óengus continued to rule Moray and challenge the kings to the south until Óengus' defeat and death at the Battle of Stracathro in 1130.
Over the following decades David I of Scotland and his successors established institutions to bring Moray more directly under Scottish control, suppressing the office of mormaer, founding monasteries, burghs and sheriffdoms within the province, and granting large areas of it as provincial lordships to loyal followers. However Moray continued to be a base for rebellions by the Meic Uilleims, the descendants of the last mormaer William fitz Duncan, until the last of the line was killed in 1230.