Leith Races were the most important horse racing event in Scotland in the eighteenth century. They took place on the sands to the east of the harbour at Leith, near Edinburgh from 1504 (or earlier) to 1816. They first gained popularity through the patronage of the Duke of Albany, the future James VII and II, while he was Royal Commissioner at the Palace of Holyrood. Their exact date of origin had been lost by the mid-19th century but there is reference in the accounts of James IV's personal expenditure to a payment made in 1504 to a jockey, "the boy that ran the King’s horse", at Leith. From the Restoration until 1816, the races took place annually with very little intermission.
Leith Races were the great working class festival of the year in the burgh and business was often suspended for the duration. They took place in the last week of July or the first week of August, and lasted for four or five days. The races were accompanied by a fair and other celebrations, the sands being covered with tents, booths and sideshows, including "roley-poleys, hobby-horses, wheels-of-fortune and many ... strange characters" Crowds could get drunken and rowdy and often brawls broke out, sometimes "along the whole length of Leith Walk".
The large crowds that attended included landowners from around the country. This made Leith an exception among race meetings in Scotland at the time, since during the eighteenth century most leading landlords looked to London for their social activity. Aristocratic patrons included Duke of Buccleuch, Duke of Hamilton and Earl of Eglinton. The races were also supported by the city magistrates, who for many years opened the races by processing from the council chambers down Leith Walk to Leith with the "City Purse" being held aloft on a pole.