The lyrics were written by Robert Burns in 1793, in the form of a speech given by Robert the Bruce before the Battle of Bannockburn in 1314, where Scotland maintained its independence from England. Although the lyrics are by Burns, he wrote them to the traditional Scottish tune Hey Tuttie Tatie which, according to tradition, was played by Bruce's army at the Battle of Bannockburn. The tune tends to be played as a slow air, but certain arrangements put it as a faster tune, as in the Scottish Fantasy by Max Bruch and the concert overture Rob Roy by Hector Berlioz.
The song was sent by Burns to his publisher George Thomson, at the end of August 1793, with the title Robert Bruce's March To Bannockburn, and a postscript saying that he had been inspired by Bruce's 'glorious struggle for Freedom, associated with the glowing ideas of some other struggles of the same nature, not quite so ancient.' This is seen as a covert reference to the Radical movement, and particularly to the trial of the Glasgow lawyer Thomas Muir of Huntershill, whose trial began on 30 August1793 as part of a British government crackdown, after the French Revolutionary Wars led to France declaring war on the Kingdom of Great Britain on 1 February1793. Muir was accused of sedition for allegedly inciting the Scottish people to oppose the government during the December 1792 convention of the Scottish 'Friends of the People' society, and was eventually sentenced to fourteen years transportation to the convict settlement at Botany Bay, Australia. Burns was aware that if he declared his Republican and Radical sympathies openly he could suffer the same fate. It is notable that when Burns agreed to let the Morning Chronicle, of 8 May1794, publish the song, it was on the basis of 'let them insert it as a thing they have met with by accident, and unknown to me.'
Bold, Alan (editor), Rhymer Rab, An Anthology of Poems and Prose by Robert Burns, Black Swan, Transworld Publishers Ltd, London 1993, ISBN 0-552-99526-6
Mackay, James A. (editor), The Complete Letters of Robert Burns, Ayr 1987.