Elgin (; , ) is a former
cathedral city and
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. 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.