Elgin was the administrative and commercial centre of the historical county of Morayshire, boasting both a cathedral and a castle.