The lyrics come from a modern poem by P. J. Kavanagh, and are set to an older tune. Kananagh edited the "Oxford Book of Shorter Poems" and, in addition to being a poet, is a columnist and broadcaster. There are no prior records of the lyrics, but they are vaguely reminiscent of a couple of songs from the time of the Peninsular War. Without documentation, Mudcat DT (Numachi) mentions the Peninsular War as the inspiration for the song. The author of the lyrics is not credited.
The Connolly's describe it as a song about an Irish young man who went to fight in the Spanish Civil War (1930s).
Google, of course, has many unsupported statements by various recorders of the song. The recording that spread the song most effectively probably was the one by the Clancy Brothers, but it had been recorded earlier in 1978. Only a few of those who recorded the tune give credit for the lyrics.