The Isle of Man and other western isles were ceded to Scotland by King Magnus Haakonson of Norway by the Treaty of Perth in 1266. It was effectively annexed by Edward I in 1290, recovered by the Scots in 1313, and taken back by the English in 1332.