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