The melody of the anthem goes back to the 1700s as a liturgical anthem in Spain. It was brought to Nicaragua shortly before independence in 1821, and was declared as the country’s first official anthem sometime between 1835 and 1837. The wordless melody was used until 1876, when it was replaced with the song “Soldados, ciudadanos” (Soldiers, Citizens). (This anthem may have been wordless until 1889). It was replaced yet again in 1893 after General José Santos Zelaya took over the country; the anthem “Hermosa Soberana” (Beautiful Sovereign) was composed by Zelaya’s son-in-law Alejandro Cousin and was written by either Rubén Darío, Santiago Argüello or Manuel Maldonado. Despite being replaced in 1910 after Zelaya fled the country, the song remains a popular patriotic song in Nicaragua.

After decades of political upheaval, which was reflected in the anthem, it was decided to bring stability back to the country by bringing stability to the anthem, so the first anthem, the piece of liturgical music brought over from Spain nearly 90 years previously, was reinstated as the anthem, but had to be recreated from memory as no written record of the music was found. Also, emergency lyrics were written by Marco Antonio Ortega under the title “La Patria Amada” (The Beloved Homeland) until a contest could be held for new lyrics.

The first priority was to arrange the old music of the national anthem, and Luis Abraham Delgadillo, a Nicaraguan composer who studied in Milan, was chosen to arrange the anthem. In 1918, the key of the anthem was changed to G major and it was made to be played by a band more easily; the new arrangement made the anthem also sound more like other “Latin American epic anthems” also in use by neighbouring countries. A contest was then held for the new lyrics for the anthem. The requirements were that there be words for both parts of the anthem, the only topic would be peace and work (as a contrast to the political upheavals of recent history) and that the words fit the melody. The winning lyrics were adopted by the government in 1939.