Craigmillar Castle is a ruined medieval castle in Edinburgh, Scotland. It is south-east of the city centre, on a low hill to the south of the modern suburb of Craigmillar. The Preston family of Craigmillar, the local feudal barons, began building the castle in the late 14th century and building works continued through the 15th and 16th centuries. In 1660, the castle was sold to Sir John Gilmour, Lord President of the Court of Session, who breathed new life into the ageing castle. The Gilmours left Craigmillar in the 18th century for a more modern residence, nearby Inch House, and the castle fell into ruin. It is now in the care of Historic Environment Scotland as a scheduled monument, and is open to the public. Craigmillar Castle is best known for its association with Mary, Queen of Scots. Following an illness after the birth of her son, the future James VI, Mary arrived at Craigmillar on 20 November 1566 to convalesce. Before she left on 7 December 1566, a pact known as the "Craigmillar Bond" was made, with or without her knowledge, to dispose of her husband Henry Stuart, Lord Darnley. Craigmillar is one of the best-preserved medieval castles in Scotland. The central tower house, or keep, is surrounded by a 15th-century courtyard wall with "particularly fine" defensive features. Within this are additional ranges, and the whole is enclosed by an outer courtyard wall containing a chapel and a doocot (dovecote). History Origins The lands of Craigmillar were granted to the monks of Dunfermline Abbey by King David I in the 12th century. The Preston family were first granted land in the area by King David II in 1342 and held 2/3 of the estate. In a further grant of 1374, King Robert II gave the remaining lands of Craigmillar to Sir Simon de Preston, Sheriff of Midlothian. It was Simon's son, Simon Preston, or his grandson, Sir George Preston, who began work on the tower house which now forms the core of the castle. This was in place by 1425, when a charter was sealed at Craigmillar by Sir John Preston. The courtyard wall was probably added by Sir William Preston (d. 1453), who had travelled in France, and drew on continental inspiration for his new work. He also brought back the arm of Saint Giles, which he presented to the High Kirk of Edinburgh, where the Preston Aisle