The Parish Kirk of Crail was founded in the second half of the twelfth century, though the site appears to have older religious associations. In its first form, it consisted of an unaisled rectangular nave and chancel of Romanesque design.
In the early thirteenth century, a tower was added at the west end and the nave was re-built with arcades of six gothic arches opening to north and south aisles and a new arch opening to the chancel. In this form, the building was dedicated to Saint MAELRUBHA of Applecross in Wester Ross on 21st June 1243 by David de Bernham, Bishop of St. Andrews. In later times it was known as St. Mary’s, probably after a later dedication in a period which disliked vestiges of the Celtic Church.
From an early period, the church belonged to the Cistercian Nunnery of St. Glare in Haddington, from which it was formally disjoined in 1594.
In 1517 it was raised to the dignity of a Collegiate Church with a Provost, ten prebendaries, and a Clerk. The erection was confirmed by royal charter in 1526. In connection with this new foundation the chancel was considerably lengthened and additional chapels were formed in the aisles of the nave.
This exalted status of the church was largely due to the indefatigable labours of one man - Sir William Myrton, who was at one time a chaplain of the Altar of St Michael the Archangel and later vicar of Lathrisk (Kingskettle). The rich furnishings of the church and its chapels are fully recorded in “The Chartulary of the Collegiate Church of Crail”.
In June 1559 John Knox preached in the Church on his way to St. Andrews, and “the old order changeth giving place to new”.
In 1587 a charter of James VI grants to the magistrates, council and community of Crail, the collegiate church with its rents for the sustentation of the Church, college and hospital.
The years 1648-1660 witnessed the tumultuous ministry of James Sharp, afterwards Archbishop of St. Andrews and murdered on Magus Muir in 1679.