The picturesque ruins of St Andrews Castle stand on a rocky promontory much worn away by the sea. Bishop Roger supposedly erected the first stone castle on the site about the beginning of the 13th century as an episcopal residence, strongly fortified. English invaders frequently captured it, and after its recapture by the Scottish regent, Andrew Murray, in 1336-37, it was destroyed lest it should fall into their hands. Towards the close of the century Bishop Trail rebuilt it in the form of a massive five-sided enclosure with a moat on the south and west sides. James I spent some of his early years within it under the care of Bishop Wardlaw, and it was the birthplace of James III in 1445. From a window in the castle Cardinal Beaton witnessed the burning of the Protestant reformer George Wishart (1546) for the crime of heresy, and in the same year a party of Reformers murdered Beaton within it. The Castle was taken from the conspirators by the French, after a year-long siege, among the prisoners captured being John Knox.