The lyrics appear to be primarily descended from an English folk song of the late 18th century called "The Unfortunate Rake", which also evolved into the New Orleans standard "St. James Infirmary Blues".
The tune is also related to "The Bard of Armagh".
The Irish ballad shares a melody with the British sea-song "Spanish Ladies". The Bodleian Library, Oxford, has copies of a nineteenth-century broadside entitled "The Unfortunate Lad", which is a version of the British ballad.