Elgin (; ; , ) is a town (former cathedral city) and formerly a Royal Burgh in Moray, Scotland. It is the administrative and commercial centre for Moray. The town originated to the south of the River Lossie on the higher ground above the floodplain where the town of Birnie is. There, the church of Birnie Kirk was built in 1140 and serves the community to this day. Elgin is first documented in the Cartulary of Moray in 1190 AD. It was created a royal burgh in the 12th century by King David I of Scotland, and by that time had a castle on top of the present-day Lady Hill to the west of the town. The origin of the name Elgin is likely to be Celtic. It may derive from 'Aille' literally signifying beauty, but in topography a beautiful place or valley. Another possibility is 'ealg', meaning both 'Ireland' and 'worthy'. The termination 'gin' or 'in' are Celtic endings signifying little or diminutive forms, hence Elgin could mean beautiful place, worthy place or little Ireland. History The discovery of the Elgin Pillar, a 9th-century class II Pictish stone, under the High Street in 1823 suggests there may have been an Early Christian presence in the area of the later market, but there is no further evidence of activity before Elgin was created a Royal Burgh in the 12th century. In August 1040, MacBeth's army defeated and killed Duncan I at Bothganowan (Pitgaveny), near Elgin. Elgin is first recorded in a charter of David I in 1151 in which he granted an annuity to the Priory of Urquhart. David had made Elgin a royal burgh around 1130, after his defeat of Óengus of Moray. During David's reign, the castle was established at the top of what is now Lady Hill. The town received a royal charter from Alexander II in 1224 when he granted the land for a new cathedral to Andrew, Bishop of Moray. This finally settled the episcopal see which had been at various times at Kinneddar, Birnie and Spynie. The ancient Forest of Darnaway was designated a Royal Forest and was used by the Scottish kings for hunting. Alexander II was Elgin's greatest benefactor and returned many times to his royal castle. He established the two religious houses of the town, the Dominicans or Blackfriars on the west side and the Franciscans or Greyfriars in the east.