The site of the Palace of Holyroodhouse has Scottish royal connections dating back to the founding of an Augustinian monastery on the site in the 12th century by King David I (r. 1124-1153). The remains of David's abbey can be seen on the north side of the Palace and is now mostly ruined after collapes and bad repairs in the 18th century.
The building of a royal palace on the site starts with James IV's building in anticipation of his marriage to Margaret Tudor, but little of his construction remains. James and Margaret's son James V built the north tower (to the left in the photos in the gallery) and began work on the west front. The arms of James and his second wife, Marie de Guise (crowned in the Abbey)
The Palace was the site of some of the most dramatic events in the reign of Mary Queen of Scots, including the murder of her secretary David Rizzio and her marriages to Henry Stuart, Lord Darnely and James Hepburn, Earl of Bothwell. Her son James VI held councils at the Palace before he became James I of England upon the death of Elizabeth I in 1603. The palace was renovated for his returns to Scotland and for the Scottish coronation of Charles I. It was damaged and repaird by Cromwell's troops during the Civil War, and was further restored under the reign of Charles II before his restoration as the English monarch. Sir William Bruce designed a tower to the east that mirrored James V's tower, creating the symmetric appearance of the Palace you see today. The Abbey church was made into the Palace's Chapel Royal during this time as well.
The Palace of Holyroodhouse is an official royal residence in Scotland and the Queen usually carries out official functions there each summer.