The melody was composed as part of Nielsen's contribution to Nye Melodier til Johan Borups Sangbog. The idea of setting music to the text apparently came from Adolf Riis-Magnussen, the editor of the songbook. See more about this work at The Royal Library