The hymn's lyrics were first published in Lynchburg, Virginia in the 1811 camp meeting songbook A General Selection of the Newest and Most Admired Hymns and Spiritual Songs Now in Use [REF].
Most sources attribute the hymn's melody to the 1701 English song "The Ballad of Captain Kidd", which describes the exploits of pirate William Kidd (misnamed "Robert" in American versions of the ballad) [REF].