The first records dating the castle are from the 12th century. In 1124, King Alexander I died here. The castle was used by him and his successor as an administrative center as well as a residence until 1286. The castle changed hands a few times between the English and the Scots until 1314 when Robert the Bruce led the Scots in a fight against Edward II and captured the castle. Most of the buildings were built between 1490 and 1600. Mary, Queen of Scots was crowned here in 1542. In 1603 King James VI of Scotland (Mary's son) was crowned as King of England and moved to London. The castle grounds were then used as a military base. There were eight sieges of the castle during the Wars of Scottish Independence and the last one was in 1746 when Prince Charlie tried to take the castle but was unsuccessful. From 1800-1964 the castle was owned by the War Office and used as barracks for Argyll and Sutherland Highlanders (Infantry Regiment which fought in both world wars and Korea).